Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Close Form without Saving Changes

Status
Not open for further replies.

fatz09

MIS
May 19, 2003
30
0
0
GB
Hello,

I have a form with a close button and when the close button is pushed a messabe box comes up to ask if you want to save the changes to the form. What code do I need in the property of the button to close the form but restore the original information and not save the changes. Thanks for any help that I recieve. It is very appreciated.

Fatz09
 
I tried that command, but it does not restore the initial information. I am trying to use this as a safety to protect against typing errors. So if you accidently delete the address and do not know it, you should be able to close the form with out saving the changes made to it. I hope this creates a clearer picture.

fatz09
 
Oh, sorry...so you've got bound fields on the form that you want to set back to the original value before leaving the form?
 
That is correct. I want to set back to the original value before leaving the form.

fatz09
 
Umm, depends on how many fields on the form...if there aren't too many then I would just hide the bound controls and make unbound controls that are what the users see and are linked to the bound controls (that way the user is never touching the actual table data). As another route forms have a "Dirty" property that turns to true when something changes on the form...you can use that to revert back to the original values as well. Just a couple things to get you pointed in the right direction...hope that helps.
 
This should do it (Access 97 code, may need tweaking for later versions)
.
If Me.Dirty Then DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
 
Thanks for the help. It works beautifully. I really appreciate it.

fatz09
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top