Undo the record before deleting it.
If Me.Dirty Then Me.Undo
If Not Me.NewRecord Then RunCommand acCmdDeleteRecord
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Kurt Heisler" <(E-Mail Removed)> wrote in message
news:1cf62daf-9b0a-4cc2-b67d-(E-Mail Removed)...
> 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?