Greetings,
I have a script I found on the 'net that verifies that all the toggle buttons on a form have been pressed. If not then a message pops up. However, while I understand what it's doing, I'm not sure how it's doing it. I was hoping that someone here could explain the syntax and what things are calling/refering to. My code is below.
Code:
Private Sub Command16_Click()
Dim ctl As Control
For Each ctl In Controls
If ctl.ControlType = acToggleButton Then
If ctl.Name <> "Toggle1" Then
If ctl.Value = 0 Then
MsgBox "Not all areas have been checked."
ctl.SetFocus
Exit Sub
End If
End If
End If
Next
End Sub
I understand that it's checking the status of each control that's a togglebutton, but I don't get what the second if statement, If ctl.Name <> "Toggle1" Then, is really doing.
I know I should be happy I found something that works, but without knowing how it's working I won't be able to modify it to fit my application. Or, rather, I'm afraid to modify it for fear of totally messing it up.
If someone could either point me to a resource on the 'net I could use, or explain the script, I would be very grateful.
Thanks,
DD