I have this code on my form's BeforeUpdate event. It is checking to make sure 2 required fields are filled before saving:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Status) Then
MsgBox "Status is required; please select a Status from the list.", vbExclamation, "Terminations Data Entry"
Status.SetFocus 'place cursor in Status field
Cancel = True 'cancels saving the record
ElseIf IsNull(StatusDate) Then
MsgBox "Status Date is required; please enter Status Date", vbExclamation, "Terminations Data Entry"
StatusDate.SetFocus 'place cursor in Status Date field
Cancel = True 'cancels saving the record
End If
End Sub
The message boxes come up just fine, but then I also am receiving this error:
"The DoMenuItem action was canceled."
How do I get rid of this error showing up? I've tried lots of things but am stuck.
Thanks for your assistance.
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Status) Then
MsgBox "Status is required; please select a Status from the list.", vbExclamation, "Terminations Data Entry"
Status.SetFocus 'place cursor in Status field
Cancel = True 'cancels saving the record
ElseIf IsNull(StatusDate) Then
MsgBox "Status Date is required; please enter Status Date", vbExclamation, "Terminations Data Entry"
StatusDate.SetFocus 'place cursor in Status Date field
Cancel = True 'cancels saving the record
End If
End Sub
The message boxes come up just fine, but then I also am receiving this error:
"The DoMenuItem action was canceled."
How do I get rid of this error showing up? I've tried lots of things but am stuck.
Thanks for your assistance.