I have two controls that I need Required. I have tried using the BeforeUpdate event to check for Null values.
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.ItemDescription) Then
MsgBox "You Must Enter an Item Description", vbCritical, _
"Canceling Update"
Me.ItemDescription.SetFocus
Cancel = True
End If
End Sub
When a user hits the Close Button, the code runs with the message, but the Close Action continues. There are about 3 ways a user could update via close, or "New Record" navigation. Is there any way to do this without writing the same code for all three buttons?
Thanks.
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.ItemDescription) Then
MsgBox "You Must Enter an Item Description", vbCritical, _
"Canceling Update"
Me.ItemDescription.SetFocus
Cancel = True
End If
End Sub
When a user hits the Close Button, the code runs with the message, but the Close Action continues. There are about 3 ways a user could update via close, or "New Record" navigation. Is there any way to do this without writing the same code for all three buttons?
Thanks.