I try with your code and do a half work. If I save a
record ( Save command on the menu ), the bottom undo
the save operation. the form must to permit save and
same time exit without save any changes. For save i have
a botton ( Botom Save ) and for exit I have a other
botom with your code.
What is it you need? Access will automaticly save any record when moving to next record, closing the form (CTRL+F4, CTRL+W, ALT+F4, clicking the "x"-button...). And when a record is saved, the undo is not available anymore. The best alternative, is perhaps to trap any attempt to "save". This might be done thru the before update event of the form.
This event will fire whenever someone tries to save a record, which might occur when trying to close a form, move to the next record, save the record using a save button...
If you use something like this (in the before update event for the form):
[tt]if me.dirty then
if msgbox("wanna save?",vbyesno)=vbno then
me.undo
end if
end if[/tt]
it will prevent any saving without the user actually confirming it, and thus also prevent closing and saving, when saving is not intended, if no, the changes will be undone. Wold this perhaps be closer to what you need?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.