Before update event of form with one of two checkboxes that have to be checked.

SteveL13
SteveL13 used Ask the Experts™
on
I have a form with two checkboxes and in the before update event of the form I have:

    If Me.chkbxQuote = False Or Me.chkbxOrder = False Then
        MsgBox "Enter selection in either Quote or Order!!!"
        Me.cmdFocus.SetFocus
        Exit Sub
        Else
    End If

Open in new window


One of the two checkboxes MUST be checked before the user can close the form.  But my code isn't working when one of them IS checked.  The msgbox still pops up.

What am I doing wrong?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Consulting
Distinguished Expert 2017
Commented:
hi,
The message pop up when one OR the other checkbox is not checked.
Go with the AND operator:
    If Me.chkbxQuote = False And Me.chkbxOrder = False Then
        MsgBox "Enter selection in either Quote or Order!!!"
        Me.cmdFocus.SetFocus
        Exit Sub
        Else
    End If

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial