Undo record save

mshirwan

Registered User.
Local time
Today, 15:53
Joined
Jul 25, 2004
Messages
20
could someone tell me how to do an undo record save?

I have an order form based on a query, the problem that I have it saves data in the sub forms when I do the undo save record, using a button.
 
m,

The short answer is that you can't. One of the good (and bad) things
about Access is the ease with which you can develop and run apps.

There are not a lot of "manual" things to be done. Like "Save" buttons
and so forth. Many times, when entering a new record, the data is
saved to the table "before you would think it is".

If you have entered a new main record, gone to a subform and entered
new related records, returned to the main form. You have already
commited that data, and Access has no easy way to back you out of
this transaction.

You can put a "Cancel Transaction" button. When pressed the button
can:

Delete all child Records:

Code:
DoCmd.RunSQL "Delete From MyChildTable Where ChildKey = " & Me.MainKey

Then delete the current Main Record.
Code:
DoCmd.RunSQL "Delete From MyMainTable Where MainKey = " & Me.MainKey

Then Requery your main form.

Just some thoughts,
Wayne
 
You should establish proper relationships between tables so you can enforce Referential Integrity and avail yourself of the Cascade Delete option. Cascade Delete will delete all order details when you delete an order so you don't have to run two queries.
 
the record gets deleted

I already setup proper relationship with cascading deletion, so it does gets deleted. What I wanted to do is not even save it to the table to start with.

but I guess i am use to SQL Server transactions, were u can undo the transaction altogether.
 
If you use DAO, you can use transactions in your Access app.
 

Users who are viewing this thread

Back
Top Bottom