How can I undo the insertion of a new record using VBA?
Thanks,
Gerry Goldberg
Thanks,
Gerry Goldberg
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me![controlname1]) Then
MsgBox "field required", vbExclamation
Cancel = True: Me![controlname1].SetFocus
elseif IsNull(Me![controlname2]) Then
MsgBox "field required", vbExclamation
Cancel = True: Me![controlname2].SetFocus
End If
End Sub
Private Sub close_click()
Dim ER As Integer
ER = MsgBox("close this form", vbQuestion + vbYesNo)
If ER = vbYes Then
Me.Undo
DoCmd.Close
End If
End Sub
Comment