Summing the check boxes is one option, but the False value is zero and the
True value is -1, so it won't be >0. Also, you'll need to make sure that you
have a default value set so that they can't be Null.
There are a few ways to loop through controls.
1) Give them a name that ends with consecutive numbers.
Example:
Dim i As Integer
For i = 1 To 15
If Me.Controls("chkMyCheckbox" & i) = True Then
'do whatever here
End If
Next i
2) Loop through all controls and check for checkbox controls.
Example:
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.ControlType = acCheckbox Then
'do whatever here
End If
Next
3) Set the Tag property of the checkboxes you want to inspect and loop
through all controls as in #2, but check the Tag property instead of the
ControlType.
--
Wayne Morgan
MS Access MVP
KARL DEWEY said:
Sum the checkboxes.
IIF(Int([CK1]+[CK2]+....+[CK15])>0, "Something is checked","None checked")
sunhealth said:
Hi,
I have a series of 15 checkboxes on a form and I would like to use a
collection to loop through
them to see if one or more have been checked. Using an if statement is
so cumbersome with so many boxes. Any thoughts would be appreciated.
Thanks to all
Sun Health