Don't want new record to post

D

Don

I have a form to enter new records. I want a button on it so that if the user
wants to leave the form and cancel the update the form will close without
posting the record to the database. How do I keep the record from posting?
 
J

Jeanette Cunningham

Hi Don,
assuming a form without any subforms, use an undo or cancel button.
The code is like this-->

Private Sub ButtonName_Click
If Me.Dirty Then
Me.Undo
End If
End Sub

You will need to remove the form's access close button (the x in top right
corner).

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 

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