Cancel update

  • Thread starter Thread starter Chad
  • Start date Start date
C

Chad

I have a form that is bound to a table. I would like to
have a cancel button that would close this form and not
save any of the changes made to the table while the form
was open. Is this possible? If so can someone lead me in
the right direction as to how to accomplish this?

Thanks,
Chad
 
Not save ANY of the changes made while the form was open or just the changes
to the current record? The latter is fairly simple, issue a Me.Undo before
closing the form.

For the previous one, the easiest way (I've done this in code, I don't know
if it will work with user input) would probably be to start a Transaction
when you open the form and either Commit or Rollback the Transaction when
you close the form. If you are in a multi-user database, I believe that all
records with pending transactions will be locked during this time, so this
isn't recommended.

Another option would be to have a table to keep track of the changes
yourself and change them back again if you choose cancel. If you are in a
multi-user database, this could be dangerous because someone else may have
made changes to one of your changed records after you were done. If you then
move the old data back, there is no telling what you may end up with.
 
Back
Top