This works for me...
1. In the '.BeforeUpdate' event for the form open a modal dialog or
message box that prompts the user "Save record?"
2. If the answer is NO then set cancel = True, and...
3. issue an "undo" command...
I know that you have probably done this--the trick is to place an "On
Error Resume Next" statement in the routine so that any errors generated
by the undo command don't crash things. The routine shown below does it
for me...
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim rslt As Integer
On Error Resume Next
rslt = MsgBox("Save this record?", vbYesNo, "test...")
If rslt = vbNo Then
Cancel = True
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
End If
End Sub
Hope this helps...
-cliff-
Quote:
> Sorry to continue on this line of questioning but I have yet to find
> an
> answer. What I want to be able to do is have the user make all the
> changes he/she wants to a record and when the focus leaves that record
> (clicking a button, going to next record, etc.) the user should get
> the
> option to save the changes or not. The problem is, how do I undo the
> saved record if the user selects no. Microsoft's page says to
> CancelEvent and SendKeys Esc but this does not work because it tries
> to
> cancel an event that can't be cancelled, such as FindRecord. If anyone
> can help me with this problem it would be greatly appriciated.
> Thanks in advance.