I have a form with many records of different people. Now the company that I am doing this work for wants me to prompt them to save each record if it has been modified when they click to go to the next record. Now I know that forms already automatically save when you make a change but I guess they are having problems with people changing the data and not knowing it. (Don't ask me).. So does someone know how I can prompt the user to save a record if it has been modified when they click to go to the next (or previous) record? Thanks
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty = True Then
If MsgBox("This record has been changed or editied." & vbNewLine & _
"Do you want to Save these changes or Undo" & vbNewLine & _
"them? [Yes = Save] [No = Undo]", vbQuestion + vbYesNo, _
"Record Changed") = vbYes Then
Dim ctlC As Control
'For each control.
On Error Resume Next
For Each ctlC In Me.Controls
If ctlC.ControlType = acTextBox Then
'Restore Old Value.
ctlC.Value = ctlC.OldValue