undoing info on fubforms

J

Jeff Klein

I want to place a cancel command button on my main form but I have data on a
subform that if changed my current undo method does not work.

DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70

How can I undo the data in the main form and the subform?
 
T

tina

if you add/edit data in the main form, then move to the subform, the record
in the main form is automatically saved by Access, and you can't prevent
that from happening. also, if you add/edit data in the subform, and then
move back to the main form, the subform record is automatically saved by
Access and, again, you can't prevent that from happening. once the data is
saved to a table, an Undo command does not work.

i can't think of any way around that, other than maybe to use "shadow"
controls and a lot of ugly code to essentially re-edit the record (main form
and/or subform) back to the values prior to the save. i think it would be a
nightmare to do it, and maybe impossible to make it foolproof.

an alternative might be to add code to both the main form and subform's
BeforeUpdate events to alert the user that the record is about to be saved,
and give him/her the opportunity to stop the save and do an Undo at that
point. note that if you make changes in the main form, the BeforeUpdate
event will fire when you try to move to the subform, and vice versa.

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top