Save or not save changes

  • Thread starter Thread starter Annelie
  • Start date Start date
A

Annelie

I know that the default in access is set to automatically save records. This
is great for new record. Is it possible that when editing a main table
record on selected forms, to not automatically save it, but display a
message something "Save the Change" and the user has to click "ok" to do it?
My users are asking for that because they have accidentally changed fields
and not even realized until later that something changed.
Annelie
 
Use the BeforeUpdate event of the *form* (not a control):

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Not Me.NewRecord Then
If MsgBox("Save the change?", vbOkCancel) <> vbOk Then
Cancel = True
'Me.Undo
End If
End If
End Sub
 
The message box comes up with an ok and cancel button, but it does not undo
the change.
Annelie
 
If you want it to actually undo the change, remove the single quote from the
line:
Me.Undo
 
Back
Top