Form Before Update action
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.txtContactFirstName) Or _
IsNull(Me.txtContactLastName) Or _
IsNull(Me.txtCompanyName) Or _
IsNull(Me.txtPhoneNumber) Then
MsgBox "The Contact First Name, " & vbCrLf & _
"Contact Last Name, " & vbCrLf & _
"Company Name, " & vbCrLf & _
"And Contact Phone Must All Be Entered", _
vbCritical, _
"Canceling Update"
Me.txtContactFirstName.SetFocus
Cancel = True
End If
End Sub
Related examples in the same category