Close form and NOT save data

D

Dave Eliot

I have a form called "Notes" which has a date/time stamp field and a
memo field. If the person writes a note and then decides not to save it,
I want a button that says "Cancel" that will close the form and NOT save
the data. (I have an "OK" button that closes the form and saves the data
that works just fine.)
 
J

Jeanette Cunningham

Dave,
use this code:

If Me.Dirty = True Then
Me.Undo
End If
DoCmd.Close acForm, Me.Name

for the cancel button


Jeanette Cunningham -- Melbourne Victoria Australia
 
D

Dave Eliot

Jeanette said:
Dave,
use this code:

If Me.Dirty = True Then
Me.Undo
End If
DoCmd.Close acForm, Me.Name

for the cancel button


Jeanette Cunningham -- Melbourne Victoria Australia
Thanks so much. Really appreciate you help.
 

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