K
Kurt Heisler
I put code in the Before Update event of my form to verify that two
fields are complete (i.e., Not Null) before saving. The code is:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.FirstName) Then
MsgBox "Please enter a first name."
Cancel = True
Me.FirstName.SetFocus
ElseIf IsNull(Me.LastName) Then
MsgBox "Please enter a last name."
Cancel = True
Me.LastName.SetFocus
End If
End Sub
Also on my form is a Delete button that deletes the record. The
problem is that if the user starts a new record, and then clicks the
delete button without having completed one of the two fields, the
Before Update event is triggered and he's asked to, "Please enter
a ... name." Any way to override this?
fields are complete (i.e., Not Null) before saving. The code is:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.FirstName) Then
MsgBox "Please enter a first name."
Cancel = True
Me.FirstName.SetFocus
ElseIf IsNull(Me.LastName) Then
MsgBox "Please enter a last name."
Cancel = True
Me.LastName.SetFocus
End If
End Sub
Also on my form is a Delete button that deletes the record. The
problem is that if the user starts a new record, and then clicks the
delete button without having completed one of the two fields, the
Before Update event is triggered and he's asked to, "Please enter
a ... name." Any way to override this?