04. december 2008 - 13:43Der 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...
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.
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...
" 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.
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..
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...
"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?
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.
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.