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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save unwanted

Status
Not open for further replies.

Bigpapou

Programmer
May 23, 2001
41
CA
Hi all,

When you close a form with the X in the upper right corner Access automaticly save the data, if there is, in the table. How to avoid that?

Tx
Bigpapou
 
If the form is meant to only look at existing you can turn off the AllowAdditions property in the main form. Then the user can't enter in data in a new record to get saved.

Joe Miller
joe.miller@flotech.net
 
Then you need to put code in the before update event to check if the record should or shouldn't be saved and code appropriately. You can cancel the update event and inform the user that they can't exit because of the current state of the record. Joe Miller
joe.miller@flotech.net
 
You should use a variable inside the form that decides whether or not the form may be closed.
Then you check the value of the var in the OnClose event. If it is FALSE, then cancel=true.
You just need to set the var to TRUE in the appropriate close command button.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top