here's an empty database with a form to demonstrate this problem.BeforeUpdateCancel.mdb
when i press the "x" at the top right of the form to close the form, the beforeupdate event fires.
in the beforeupdate event i set the Cancel variable to True --> because i want to cancel the update.
the result of this is that this message box pops up.
goal: i want to cancel the form update when the user clicks the "x" at the top right of the form.
question --> 1) why is this msgbox popping up? could yall give me a technical insight into the mechanisms of it?
2) how do i achieve my goal of canceling the form update when the user clicks the "x"?
P.S. i found the solution is to only use the Me.Undo line without the Cancel = True --> and i do understand the difference between Undo and Cancel, but i just can't understand why the Cancel = True when the form is closing causes a problem? definitely i suspect that i'm "tinkering" around with the inner workings of Access cause the form is closing with presumably an automatic save and i am asking it to cancel the save
here are 2 great posts which helped me quite a bit but just shy of the final problem i've posted here
a) from EE PatHartman really helped me a lot on this but using her code somehow it's not working i'm not sure why http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_28259652.html
b) another developer facing the same problem who resorted to quite a long way of doing things i feel http://bytes.com/topic/access/answers/647206-cancelling-record-update-beforeupdate-event