Using <Esc> to undo isn't exactly straight-forward! See if this explains it:
- If you enter data, say in ControlA, then hit <Esc> the data in ControlA is undone and the Form_Undo event will fire
- If you enter data in ControlA, then enter data in ControlB and then hit <Esc>...the data in ControlB will be undone...but the Form_Undo event will not fire!
- If you hit the <Esc> key once more, the data in ControlA will be undone and the Form_Undo event will then fire!
Confused enough? To restate it, if data has been entered/edited in one Control and <Esc> is hit, that Control is undone and because it is the only Control that can be undone, the Form, itself, is considered to be undone and Form_Undone fires.
If more than one Control has had data entered, and <Esc> is hit twice, the first hit undoes the last Control entered while the second hit undoes all other Controls and the Form, itself, is considered undone, and Form_Undone fires.
Linq ;0)>
The problem with making anything foolproof...is that fools are so darn ingenious!
All posts/responses based on Access 2003/2007