https://stackoverflow.com/questions/3813760/determine-whether-a-access-checkbox-is-checked-or-not
Here’s what I’m playing with. I have four checkboxes.
chkCheckBox1
chkCheckBox2
chkCheckBox3
chkSomethingIsChecked
The Tag property for the first three checkboxes has been set to “ABC”
Here is the original code I was trying:
Expand|Select|Wrap|Line Numbers
- Dim ctrl As Control
- For Each ctrl In Me.Controls
- If ctrl.Tag = "ABC" Then
- If ctrl.Value = True Then
- chkSomethingIsChecked.Value = True
- Else
- chkSomethingIsChecked.Value = False
- End If
- End If
- Next ctrl
Next, I tried:
Expand|Select|Wrap|Line Numbers
- Dim ctrl As Control
- Dim CheckBoxCount as Integer
- For Each ctrl In Me.Controls
- If ctrl.Tag = "ABC" Then
- If ctrl.Value = True Then CheckboxCount = CheckboxCount + 1
- End If
- Next ctrl
- If CheckboxCount > 0 Then
- chkSomethingIsChecked.Value = True
- Else
- chkSomethingIsChecked.Value = False
- End If
That leads me to ask is there something about the BeforeUpdate event that is different than a Click event and causes this code to fail?