Newbie - Exit w/o update

B

Bumbino

I have a new database and I want to give the user a chance to exit the form
without the info they have entered into the controls being added to the
table. There are 5 controls but when they select the exit button, anything
that they have entered still gets saved to the table. This happens even if
they have only entered text into 1 control. Any help would be appreciated.
 
K

Klatuu

A record in a form will be updated whenever you move to a different record or
close the form. You can control that in click event of your exit button by
asking the user if the want to save the record:

If Me.Dirty Then 'There is changed or new data in the record
If MsgBox("Save This Record", vbQuestion + vbYesNo) = vbYes Then
Me.Dirty = False 'Saves the record
Else
Me.Undo 'Destroys the record
End If
End If
 

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