close and do not save

D

Dave

Access 2003
Data entry Form

if they put in "some data" then decide againse saving the record I have used
this code on a button:

DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
DoCmd.Close

HOWEVER:
If they enter nothing and try to cancel I get an error something like "Undue
not avaiable"

How can I fix this.

Thanks much

Dave
 
A

Allen Browne

Test the Dirty property of the form to see if it needs to be undone or not:

If Me.Dirty Then Me.Undo
DoCmd.Close acForm, Me.Name
 
D

Dave

Thank you again,

dave

Allen Browne said:
Test the Dirty property of the form to see if it needs to be undone or
not:

If Me.Dirty Then Me.Undo
DoCmd.Close acForm, Me.Name
 

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

Similar Threads


Top