G
Guest
I was coding a form with groups of checkboxes that must have at least one
checked before the user can get out of the form. I used the "Cancel = True"
code just as I was supposed to. It tells them they must check at least one,
just like it is supposed to, but if they say OK, it gives them a choice to
either go back into the form or exit without saving. I can't afford to give
them a choice.
Private Sub Form_BeforeUpdate()
If AntecedentCheckBoxSum = 0 Then
MsgBox "AT LEAST ONE ANTECEDENT MUST BE CHECKED."
Cancel = True
End If
If BehaviorCheckBoxSum = 0 Then
MsgBox "AT LEAST ONE BEHAVIOR MUST BE CHECKED."
Cancel = True
End If
If ConsequenceCheckBoxSum = 0 Then
MsgBox "AT LEAST ONE CONSEQUENCE MUST BE CHECKED."
Cancel = True
End If
If IntensityCheckBoxSum = 0 Then
MsgBox "AT LEAST ONE INTENSITY MUST BE CHECKED."
Cancel = True
End If
End Sub
checked before the user can get out of the form. I used the "Cancel = True"
code just as I was supposed to. It tells them they must check at least one,
just like it is supposed to, but if they say OK, it gives them a choice to
either go back into the form or exit without saving. I can't afford to give
them a choice.
Private Sub Form_BeforeUpdate()
If AntecedentCheckBoxSum = 0 Then
MsgBox "AT LEAST ONE ANTECEDENT MUST BE CHECKED."
Cancel = True
End If
If BehaviorCheckBoxSum = 0 Then
MsgBox "AT LEAST ONE BEHAVIOR MUST BE CHECKED."
Cancel = True
End If
If ConsequenceCheckBoxSum = 0 Then
MsgBox "AT LEAST ONE CONSEQUENCE MUST BE CHECKED."
Cancel = True
End If
If IntensityCheckBoxSum = 0 Then
MsgBox "AT LEAST ONE INTENSITY MUST BE CHECKED."
Cancel = True
End If
End Sub