Question How to undo updated record in a table

mshafi

New member
Local time
Yesterday, 17:57
Joined
Jun 4, 2011
Messages
2
Dear,

In the middle of data entry in a MS Access form, If the user press cancel button, the updated record in a table must be undo.
Ho it is possible.
I can delete the newly entered record, but i need to undo the updated record also.
 
Welcome to the forum.

Have a look at Me.Undo this cancels the edits in a specific form, so that it is no longer dirty. Once the form is no longer dirty, no further undo is possible, because it has reached the desired state.
 
Dear John,
Thanks for your reply.

I tried this option. But it is not giving correct result.
I am entering the purchase details using one form.
In this form new records are created in two tables (tablePurchase and tblPurchaseDetails.) and quantity fields in another table is updating.
In the middle of data entry, if the user press the cancel button i need to go back the previous stage. i.e delete newly created record in two tables and chage the updation made one quantity table.
 
You must use Transactions.

Create a DAO.Workspace object and link it to DBEngine.Workspaces(0).

Then call BeginTrans and after update all tables, if it´s all ok do a CommitTrans, if you want to undo it call Rollback.
 
Before using transactions to cure design problems, it would be interesting to get some more details:


  • Is your form based on a query with a join between the two tables?
  • How does tablePurchase change if a record tblPurchaseDetails is added or updated?
  • How/why is some other table updated, PRIOR to saving data in tblPurchaseDetails?
  • What is the purpose of a Cancel if data HAS been stored?

Show the code for the Undo
 

Users who are viewing this thread

Back
Top Bottom