djburnheim
Technical User
I have a form with about 20 questions and Yes/No option buttons...when the user clicks OK I want to call a procedure to check that all questions have been answered and if there are any "No" answers...I have code that will check all the option buttons but it only works if the user has answered yes.
Dim ctrl As Control
Dim Complete As Boolean
'Check to see if all checks have been done
For Each ctrl In frmUserForm.Controls
If TypeName(ctrl) = "OptionButton" Then
If ctrl = False Then
Complete = False
Else
Complete = True
End If
End If
Next ctrl
If Complete = True Then
frmChecklist.cmdOK.Enabled = True
End If
Dim ctrl As Control
Dim Complete As Boolean
'Check to see if all checks have been done
For Each ctrl In frmUserForm.Controls
If TypeName(ctrl) = "OptionButton" Then
If ctrl = False Then
Complete = False
Else
Complete = True
End If
End If
Next ctrl
If Complete = True Then
frmChecklist.cmdOK.Enabled = True
End If