Cancel button on a Form

G

Guest

Hi there,

I have a Form bound to a table in the database that is used to
enter/view/update records in that table.

When one navigates the records and say, makes a change to some of the data
of one record, but then one doesn´t want these changes .... if one closes the
screen/Form the new unwanted data gets used to update that record. I have put
a Cancel button on the form to cancel - meaning: abort the changes, close the
screen without updating the database.

How do I avoid the update to the database ?

Thank you very much.
Cheers
 
K

Keith W

Fernando said:
Hi there,

I have a Form bound to a table in the database that is used to
enter/view/update records in that table.

When one navigates the records and say, makes a change to some of the data
of one record, but then one doesn´t want these changes .... if one closes
the
screen/Form the new unwanted data gets used to update that record. I have
put
a Cancel button on the form to cancel - meaning: abort the changes, close
the
screen without updating the database.

How do I avoid the update to the database ?

I wouldn't use a button at all, I'd use something like this in the form's
Before Update event:

If MsgBox("Do you want to save the changes?", vbYesNo,"Confirm Change")
= vbNo Then
Cancel = True
Me.Undo
End If

HTH - Keith.
www.keithwilby.com
 

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