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

Exit of a form without save?

Status
Not open for further replies.

wrong12

MIS
Jan 30, 2003
15
VE
I have a form and I need exit on form without save
any change. How can I do it?
 
you can use the following code to achieve this:

'first undo changes and close
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, ,acMenuVer70
DoCmd.Close
 
I try with your code and do a half work. If I save a
record ( Save command on the menu ), the bottom undo
the save operation. the form must to permit save and
same time exit without save any changes. For save i have
a botton ( Botom Save ) and for exit I have a other
botom with your code.
 
will this work for you?

DoCmd.Close acForm, "form_name", acSaveNo
 
Hi!

What is it you need? Access will automaticly save any record when moving to next record, closing the form (CTRL+F4, CTRL+W, ALT+F4, clicking the "x"-button...). And when a record is saved, the undo is not available anymore. The best alternative, is perhaps to trap any attempt to "save". This might be done thru the before update event of the form.

This event will fire whenever someone tries to save a record, which might occur when trying to close a form, move to the next record, save the record using a save button...

If you use something like this (in the before update event for the form):

[tt]if me.dirty then
if msgbox("wanna save?",vbyesno)=vbno then
me.undo
end if
end if[/tt]

it will prevent any saving without the user actually confirming it, and thus also prevent closing and saving, when saving is not intended, if no, the changes will be undone. Wold this perhaps be closer to what you need?

Post back if you have any questions.

HTH Roy-Vidar
 
thanks very much for yuor help.
I really apreciate it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top