Hi
I want to ask the user if they want to exit without saving a form (after making changes to a record). I can get the code to work if I use 'Form_Unload' and close the form using DoCmd.Close. But when I step thru the records using the nav. bar this doesn't work.
I have also tried ...
Private Sub Form_BeforeUpdate(Cancel As Integer)
If MsgBox("Exit without Saving?", vbYesNo) = vbYes Then
Exit Sub
Else
Cancel = True
End If
End Sub
This seems to detect a change made on the form and offers the prompt on closing/navigating...but the change made by the user is not ignored .. it is still saved?
Any ideas? - thanks
I want to ask the user if they want to exit without saving a form (after making changes to a record). I can get the code to work if I use 'Form_Unload' and close the form using DoCmd.Close. But when I step thru the records using the nav. bar this doesn't work.
I have also tried ...
Private Sub Form_BeforeUpdate(Cancel As Integer)
If MsgBox("Exit without Saving?", vbYesNo) = vbYes Then
Exit Sub
Else
Cancel = True
End If
End Sub
This seems to detect a change made on the form and offers the prompt on closing/navigating...but the change made by the user is not ignored .. it is still saved?
Any ideas? - thanks