Avatar billede salimbharuchi Nybegynder
04. december 2008 - 13:43 Der er 10 kommentarer og
1 løsning

CheckBox Control Problems

Hi Experts,
i have a continous form... and have one button on it, to all records with unbound checkbox.
Onclick property to this button  Docmd.RunSQL " Insert into .....

when i click on my button it runs SQL..but after running SQL it must automatically make my unbound check box to -1 for that record...
how to do this...
Avatar billede terry Ekspert
04. december 2008 - 14:56 #1
"must automatically make my unbound check box to -1 for that record..."

You cant!

The checkbox must be bound
Avatar billede terry Ekspert
04. december 2008 - 14:57 #2
but is this a problem if it is bound?
Avatar billede jesperfjoelner Nybegynder
04. december 2008 - 15:12 #3
Man selvfølgelig godt undlade at binde en chk-box til data, men det giver ikke så meget mening, især ikke i en continous form, da alle chkboxe så vil have samme property (0,-1) og altså ikke kan angive noget om bagvedliggende data.

Hvorfor ikke binde chkboxen til tabellen og have et boolean-felt i tabellen som med true/false angiver om du har kørt SQL for den post.
Avatar billede salimbharuchi Nybegynder
04. december 2008 - 15:46 #4
No prbs even if its bound....
Avatar billede salimbharuchi Nybegynder
04. december 2008 - 15:50 #5
infact on the form i have two textboxes and a checkbox also a insert button...which inserts data into table....for every record...but just to make it visual to person who is inserting each records to table...i have place check box which indicates it is finished inserting...
Avatar billede terry Ekspert
04. december 2008 - 18:04 #6
" have place check box which indicates it is finished inserting..."
Wouldnt a message box be able to do that?
The reason I suggested binding the checkbox was so that you could see that that record had been INSERTed. Annd that information would also be available even if youclsed the dB and opened again.
Avatar billede salimbharuchi Nybegynder
04. december 2008 - 18:47 #7
ID  NAME DATE          STATUSCODE  COMMENTS                ButtonInsert  CheckBox
1  abc  04-12-2008    Sick        adsfadf                  Insert_button  Tick
1  abc  03-12-2008    Homework    adfasdf .....................................
2  aabbc  01-12-2008    Hospital    adfasdf .....................................
2  aabbc  02-12-2008    sick    adfasdf .....................................
2  aabbc  03-12-2008    Present    adfasdf .....................................

Above is the example for my form...ID is textfield,,,name textfield,,,and so on....
each row in the above example is my record in continues form...and button insert is always der on each record...on click property to button_insert i have Docmd.Runsql insert in to table...with values... so when i click on insert it runs my SQL in VBA  code...after inserting values:  1 abc 02-12-2008    Hospital    adfasdf into my table...i want something by which i can see that i have inserted this record..so i thought off checkmark..which just indicates to each field when clicked on insert button that it is inserted...you talking about message...well i am infact getting message on each insert record..it says normal record update message..you are about to update record...but terry if its possible to delete record after insert i dont mind..

hope this helps...
Avatar billede salimbharuchi Nybegynder
04. december 2008 - 18:49 #8
well this information is in my temporary table..data gets deleted everytimes so even if my check box is there for eachrecord it will be deleted in next time...
Avatar billede terry Ekspert
04. december 2008 - 18:57 #9
"but terry if its possible to delete record after insert i dont mind.."?

So you enter data into a TEMP table and then when you press the button it gets inserted into a permanent table. Then when that is doe you want to delete the records from the TEMP table? So you dont need a checkbox anymore?
Avatar billede terry Ekspert
04. december 2008 - 19:03 #10
Lets say you have a BOUND check box in the TEMP table. And you dont have a button on the continuouse form but a single button at the bottom (footer) of the form.

Now you make an append query which copies records from the TEMP table to the permanent table. This query has a criteria so that it only takes those where the check box is set to true.

So the user selects (checks) one or more record in the form and then presses the button which now runs (opens) the append query which copies ALL records from the TEMP table into the permanent table where checkbox = true.

An dyou could also have a delete query which now deletes the records.
Avatar billede salimbharuchi Nybegynder
05. december 2008 - 10:17 #11
Excellent...Terry
Thanks alot..
Its working...
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Dyk ned i databasernes verden på et af vores praksisnære Access-kurser

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester