'------------------------------------------------------------
' Form_BeforeUpdate(Cancel As Integer)
' Validation that requires user to enter first name, last
' name and username to save a record.
'
'------------------------------------------------------------
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Len([txtFirstName] & vbNullString) = 0 Then
[COLOR=red]MsgBox "Please enter a First Name.", vbOK + vbExclamation +
[/COLOR] vbDefaultButton2, "Empty Field"
ElseIf Len([txtLastName] & vbNullString) = 0 Then
[COLOR=red]MsgBox "Please enter a Last Name.", vbOK + vbExclamation +
[/COLOR] vbDefaultButton2, "Empty Field"
ElseIf Len([txtUserID] & vbNullString) = 0 Then
[COLOR=red]MsgBox "Please enter a UserID Name.", vbOK + vbExclamation +[/COLOR]
vbDefaultButton2, "Empty Field"
End If
If Not IsNull(Me.txtFirstName) Then
If Not IsNull(Me.txtLastName) Then
If Not IsNull(Me.txtUserID) Then
MsgBox "A new user has been successfully added to the
[COLOR=red]database.", vbInformation + vbOKOnly, "User Update"
[/COLOR] End If
End If
End If
End Sub