I have a form with various check boxes. if one checkbox is selected it throws a warning if you select yes then all checkboxes will be cleared. This part works just fine, however if you click no to cancel it it seems to work, but when you try to go to another control on the form or advance to the next record it throws the alert again. It seems it is not canceling truely. my code is below
Private Sub blnallowidcheckout_BeforeUpdate(Cancel As Integer)
'Checks group checkboxes and if any are checked gives vbyesno message box
'if yes is selected all checkboxes are cleared
'if no selected nothing happens
Debug.Print blnallowidcheckout
If blnbstseai Or blnbstsmts Or blnbstsdb Or blnbstsests _
Or blnbsmo Or blnbsstaff Or blnbsabap Or blnbschangesup _
Or blnbsfinance Or blnbscommkt Or blnbssupply Or blnsstools _
Or blnsseim Or blnbsqrrc Then
Dim intResponse As Integer
Dim strPrompt As String
strPrompt = "Clear all enabled checkboxes for Groups Allowed to Checkout ID?"
intResponse = MsgBox(strPrompt, vbYesNo + vbDefaultButton2)
If intResponse = vbYes Then
blnbstseai.Value = False
blnbstsmts.Value = False
blnbstsdb.Value = False
blnbstsests.Value = False
blnbsmo.Value = False
blnbsstaff.Value = False
blnbsabap.Value = False
blnbschangesup.Value = False
blnbsfinance.Value = False
blnbscommkt.Value = False
blnbssupply.Value = False
blnsstools.Value = False
blnsseim.Value = False
blnbsqrrc.Value = False
blnioiptel.Value = False
blniopcm.Value = False
blniocts.Value = False
blnionts.Value = False
blnioeurope.Value = False
blnioasia.Value = False
blniobrazil.Value = False
Else
MsgBox blnallowidcheckout
Cancel = True
End If
End If
End Sub
Private Sub blnallowidcheckout_BeforeUpdate(Cancel As Integer)
'Checks group checkboxes and if any are checked gives vbyesno message box
'if yes is selected all checkboxes are cleared
'if no selected nothing happens
Debug.Print blnallowidcheckout
If blnbstseai Or blnbstsmts Or blnbstsdb Or blnbstsests _
Or blnbsmo Or blnbsstaff Or blnbsabap Or blnbschangesup _
Or blnbsfinance Or blnbscommkt Or blnbssupply Or blnsstools _
Or blnsseim Or blnbsqrrc Then
Dim intResponse As Integer
Dim strPrompt As String
strPrompt = "Clear all enabled checkboxes for Groups Allowed to Checkout ID?"
intResponse = MsgBox(strPrompt, vbYesNo + vbDefaultButton2)
If intResponse = vbYes Then
blnbstseai.Value = False
blnbstsmts.Value = False
blnbstsdb.Value = False
blnbstsests.Value = False
blnbsmo.Value = False
blnbsstaff.Value = False
blnbsabap.Value = False
blnbschangesup.Value = False
blnbsfinance.Value = False
blnbscommkt.Value = False
blnbssupply.Value = False
blnsstools.Value = False
blnsseim.Value = False
blnbsqrrc.Value = False
blnioiptel.Value = False
blniopcm.Value = False
blniocts.Value = False
blnionts.Value = False
blnioeurope.Value = False
blnioasia.Value = False
blniobrazil.Value = False
Else
MsgBox blnallowidcheckout
Cancel = True
End If
End If
End Sub