check if any data in form is changed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I check the controls on form for any changes before saving or closing
that form. Do I have to do this one control at a time or can we just check
the "Form"? Also, on the messageBox how can we add a yes/No option to save or
undo the changes?
 
you can run code on the *form's* BeforeUpdate event. this event only runs if
data is changed in the current record. try adding the following code to the
BeforeUpdate event procedure, as

If Msgbox("Save changes?", vbYesNo) = vbNo Then
Cancel = True
Me.Undo
End If

hth
 

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

Back
Top