View Full Version : Cancel update after having added a record


Danielf
05-22-2000, 05:44 AM
I have a form based on a table;

I know that with "Me.undo", you can cancel updates made in the form.
But when I add a new record in this form and after I try
me.undo, the new record is still in the table, but even
the changes made to the form are still in my table.
The "Me.undo" doesn't work anymore;
Is there another way to cancel an update?

Thanks for help

Daniel

Carol
05-22-2000, 08:07 AM
Create a control button on your form Called Delete and place this code behind it on the "On Click" as an event procedure:
Private Sub Delete_Click()
On Error GoTo Delete_Click_Err

' Deletes Current Record Shown in Form View from Active Tables
DoCmd.RunCommand acCmdDeleteRecord


Delete_Click_Exit:
Exit Sub

Delete_Click_Err:
MsgBox Error$
Resume Delete_Click_Exit

End Sub

This will delete the current record shown. This will work as long as you have not used this record in the saving of another record, i.e. referential integrity.
Good luck.