Running code on Form save cancel

mcdhappy80

Registered User.
Local time
Today, 20:30
Joined
Jun 22, 2009
Messages
347
If I change some data on the current record in form, and then, instead of saving that change, I click ESC to cancel the change, is there a way to trigger some code then, and what is the name of that event, and is it a forms event?
Thank You
 
You can use the form's UNDO event (I know it is in 2003 and beyond but not sure about when it was added).
 
Interesting question. I would put a pc of code like msgbox in each of the forms events and see if any of them fire when you hit esc.
 
Interesting question. I would put a pc of code like msgbox in each of the forms events and see if any of them fire when you hit esc.

Actually, if you have a bound form and do this - I know the UNDO event works. But I don't know when the UNDO event came into being. Do you have Access 2000 with you Ken? I don't have it available at the moment (all I have here at work is 2003). If so, could you check?
 
Keep in mind, undo will undo every change you made to the record. So if you have a record with 10 fields and you put values in every one of them and then undo, it will undo all 10 values, not just the last one. I am just pointing this out because undo in access does not behave like undo in word or excel.
 
Sounded like he merely wanted to trap the user pressing the esc key - I may be missing something...
 
Sounded like he merely wanted to trap the user pressing the esc key - I may be missing something...

Yeah, I thought so too, but I wrote what I wrote even though it didn't answer his question because it was something I have been burned by before - maybe it will help someone else.
 

Users who are viewing this thread

Back
Top Bottom