close a form without saveing

M

max

I 've a form where an user can modify anything. I added this code to the
close button in oprder to UNDO if a user close the form without save. But if
the user open the form by mistake and press the close button an error
appears. They also have a SAVE button. I just want to save the changes ONLY
if they press the SAVE button.

UNDO command:
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, ,acMenuVer70

Error:
The command or action UNDO isn't available now
 
N

Nikos Yannacopoulos

Max,

Instead of undoing, try to close the form without saving, like:

DoCmd.Close acForm, Me.Name, acSaveNo

HTH,
Nikos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top