L
lcox400w
I am having trouble with a VByes no msg box. No matter if I pick yes or no,
it always goes to the "no" option and runs the "else" porton of the code. I
cant for the life of me figure out why. The code is suppose to check to see
if DRNo is null. If so it asks the user if they want to close the form or
not. Selecting yes would close the form, selecting no then keeps the focus
on the DRNo field so they can fill out the field. I'm confused as to why it
keeps going to the else portion of the statement and ignores the VBYES code...
Dim DRResponse
If IsNull(DRNo) Or DRNo = "" Then
If DRResponse = MsgBox("You did not put a DR number in. A DR is
required. Do you want to close the form and lose any data you have
entered?", vbYesNo) = vbYes Then
On Error Resume Next
DoCmd.Close
Exit Sub
Else
DRNo.SetFocus
Cancel = True
Exit Sub
End If
Else
End If
it always goes to the "no" option and runs the "else" porton of the code. I
cant for the life of me figure out why. The code is suppose to check to see
if DRNo is null. If so it asks the user if they want to close the form or
not. Selecting yes would close the form, selecting no then keeps the focus
on the DRNo field so they can fill out the field. I'm confused as to why it
keeps going to the else portion of the statement and ignores the VBYES code...
Dim DRResponse
If IsNull(DRNo) Or DRNo = "" Then
If DRResponse = MsgBox("You did not put a DR number in. A DR is
required. Do you want to close the form and lose any data you have
entered?", vbYesNo) = vbYes Then
On Error Resume Next
DoCmd.Close
Exit Sub
Else
DRNo.SetFocus
Cancel = True
Exit Sub
End If
Else
End If