Full Version: Button to close form and discard changes to the record
UtterAccess Forums > Microsoft® Access > Access Forms
Alpha7
Hi All,
I have a form bound to a table, and it has about 4 text fields on it.
I would like to create a button on the form that closes it, but does not save any changes that have been made to the record.
Sometimes a new record is being created, and other times an existing record is being modified.
I have tried using SendKeys {Esc}{Esc} before the DoCmd.Close but this only works for a new record being inserted, and isn't particularly elegant.
Is there a proper command to use that will disregard changes to the record?
Many Thanks
ODLStelco
Hey There
est way to do this is in the on click event, enter the following code
CODE
Me.undo
me.close

HTH
Chris
Alpha7
Thanks, that works great.
ODLStelco
No Prob!
uarulez2.gif
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.