JasonPurdueEE
Technical User
Hello everybody. I have a form with 41 different check boxes on it and want to verify that at least one has been "checked" before allowing a user to exit the form. I am having difficulty getting my for loop to work, perhaps somebody could provide some assistance or reccomend a better way of accomplishing this.
The check boxes are titled chk1, chk2, chk3...chk41. They reside in a subform called subCause. I would like my if statement to read: "If (Me!subCause.Form.chk1.value = -1) Then" and increment from chk1 to chk41.
Here's what i have so far:
Perhaps I am making this too complicated, is there a simple way to check that at least one check box has been checked?
Thanks,
Jason
______________________________
Sleep is a poor substitute for coffee.
The check boxes are titled chk1, chk2, chk3...chk41. They reside in a subform called subCause. I would like my if statement to read: "If (Me!subCause.Form.chk1.value = -1) Then" and increment from chk1 to chk41.
Here's what i have so far:
Code:
'*******************************************
Dim strIf as String
Dim i As Integer
For i = 1 To 41
strIf = ("Me!subCause.Form.chk" & i & ".value = -1")
If strIf Then 'here's where I run into problems
'do stuff here
End If
Next i
'********************************************
Perhaps I am making this too complicated, is there a simple way to check that at least one check box has been checked?
Thanks,
Jason
______________________________
Sleep is a poor substitute for coffee.