I am not a beginner with Access, but I am a beginner when it comes to VBA code. I learn code as I need it and I am normally successful finding what I need on tech boards. I am on my 3rd day of searching for this solution. I would greatly appreciate any help and would also be ok to have that help dumbed down to the most basic level.
I have a form that has a list of products. There is a checkbox for each product (named: Check100-Check199). The user can select multiple check boxes. I want a check box at the top of the form that says... "Select All" and when that is selected, I want all the product check boxes to be selected. I have figured out how to do this the "long" way using code similar to this:
Private Sub CheckSelectAll_Click()
If Me.CheckSelectAll = True Then
Me.Check100 = True
Me.Check101 = True
Me.Check102 = True
ElseIf Me.CheckSelectAll = False Then
Me.Check100 = False
Me.Check101 = False
Me.Check102 = False
End If
The problem is I have a lot of boxes and may add boxes. So to avoid hundreds of lines of code, I would like my code to say this:
Private Sub CheckSelectAll_Click()
If Me.CheckSelectAll = True Then
Me.Check100 through Check199= True 'this is the line I can't get to work'
ElseIf Me.CheckSelectAll = False Then
Me.Check100 through Check199 = False 'this is another line I can't get to work'
End If
The solutions that I have browsed are very complicated and quite honestly I have no idea what they mean so I hesitate to use them and/or don't know why they don't work when I do try them. Is there an easy way to do this?
Thanks.
Start Free Trial