Unanswered: MS Access, VB, button to clear 'ticks' will not work
This should be easy but I just cannot get it to work, this forum has helpful earlier,
This is a simple problem....
I have a Form.
In the Form, I have a 'tick' box i.e. Check box (SETHIGHLIGHT) that the user can check - It is used to set highlights in a record - that works fine... My problem Is, I made a button (Remove_All_Highlights) intending to simply clear all the SETHIGHLIGHT checkboxes
What happens is, when I press the button, ONLY The last checkbox that was checked gets unchecked... all the others Records SETHIGHLIGHT stays checked. (Sounds simple huh?- its killing me, I tried several things, but it should be simple<I think>)
Here is my code:
Private Sub Remove_All_Highights_Click()
SETHIGHLIGHT = False
Any suggestions would be appreciated (totally-pbm was fantastic last time)
This form can hold anwhere from 200-1000 records. This one im using has 260 records for develoment-your routine scrolls speedily through all the records and resets all the ticks in that column.
Thank you so very very much.....
While I built this entire program myself (newbie) for the most part I have augured through the problems but this is a bit out of my <programming> league(two days and 1/2 head of hair).
I will now tredge on......!
That is very nice, nicer than the first one. Definetly more elegant.
Since I am not a real prgrammer(more of a hardware guy that piddles in code when I must), I would not be able to incorprate that style unless it was setup like your first suggestion- that was easy to sew into my Form.
- Heck I even added a message...."Are you sure you want to remove ALL highlights... this cannot be reversed" -yesno
My form is single level. Very basic but functional for the application over the present Excel being used now...
Appreciate your expertise Goldy, really.
Does work with a bit of a bug.
When the 'remove' button is pressed, a popup comes saying " You are about to update 260 Rows..... etc" this is OK but can I modify the verbage?
If you press YES, it deletes the ticks just fine
If you press NO, a popup comes up saying...."Run-Time Error 2501. The Run SQL Action was cancelled .... and gives buttons to Debug...
Here is the code:
Private Sub Remove_All_HighLites_Click()
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.RunSQL "UPDATE tblPropertyLists SET tblPropertyLists.SETHIGHLIGHT = 0;"
(Note I earlier mispelled ..... All_HighLites_Click() << is correct.