Undo changes in form and sub-form

eyalco

Registered User.
Local time
Today, 14:44
Joined
Jul 24, 2007
Messages
50
I have an invoice form with a sub-form (the invoice items, prices etc).
everytime I enter the form, I need to undo anything written when I leave without saving (only when I press yes for saving should it be saved).
How can I do this both in the form and the sub-form please?
Thanks.
 
There is a command for undoing the current record, which is

Docmd.RunCommand acCmdUndo

This can be done on the main form, or the subform, but I am not positive if it can be done to both at the same time. I believe once you go to the subform the mainform record automatically saves, but maybe someone else can add something further. Try this command and see how it goes, it can be attached to a button, so you could have a Save and Cancel button.

You also have to watch out for scrolling through records, cause once you scroll off the record it will automatically be saved.
 
Once you've moved to the subform, the main form record has been saved and if you move back to the main form the subform record has been saved. If you wish to "undo" at any of those points you can undo the current record (using the Before Update event) but the other record would need to be deleted using a delete query.
 

Users who are viewing this thread

Back
Top Bottom