Uncheck checkbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have a form with 6 check boxes. Box1 has a default of True. If ANY other
boxes are checked, I would like to automatically uncheck box1. Can you tell
me the best way to do this?

Thanks,
 
If you use seperate checkboxes you have to check every box when clicked on.
Fortunately the code is same for every checkbox:

me.checkbox1=not me.checkbox2
me.checkbox1=not me.checkbox3

etc.

put the code in the onclick event of the checkbox.
If you are working on a form and want to do the action as a final check you
could loop through the checkboxes and set checkbox based on the the values
of the other checkboxes.

hth
 
Thanks Maurice,

I'm afraid I didn't explain myself very well. Box1 is the only check box I
want this to happen to. The other 5 can be checked in any combination...If I
check box2, box1 gets unchecked, if I check box3, box1 gets unchecked, if
multiple boxes are checked, box1 should be unchecked, etc. Boxes 2-6 can be
all checked, or any combination.

Thanks,
 
Hi Marc,

I misread sorry for that. In the on click of the checkboxes just put:

me.checkbox1=false

This will make checkbox 1 be unchecked based on the choices you make (also
the combinations eg 2 and 5 are checked)

hth
 
Put this function in your form's module and change the names to the actual
names of your check boxes.

Private Sub CheckTheBoxes()
With Me
If .Check10 + .Check2 + .Check4 + .Check6 + .Check8 <> 0 Then
.Check0 = False
Else
.Check0 = True
End If
End With

End Sub

Call it in the After Update event of each of the checboxes

Private Sub Check10_AfterUpdate()
Call CheckTheBoxes
End Sub
 
Back
Top