check if any data in form is changed

M

Moe

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?
 
T

tina

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
 
Top