Cancel editing recordsource data?

  • Thread starter Thread starter Arnfinn Vartdal
  • Start date Start date
A

Arnfinn Vartdal

I would like to do the following on a form:
When the user leaves the current record (goes to next/previous, closes form
etc) he should get the question: "Data has changed. Do you want to save the
changes?" with the options yes/no/cancel.
How can I do that in Access?

Arnfinn
 
Use the BeforeUpdate event procedure of the Form to provide the MsgBox for
the user:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Select Case MsgBox("Save?" vbYesNoCancel As Integer)
Case vbYes
'do nothing
Case vbNo
Cancel = True
Me.Undo
Case vbCancel
Cancel = True
End Select
End Sub
 
Back
Top