Try the following:
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strMsg As String
' Dim iResponse As Integer
' Specify the message to display.
strMsg = "Do you wish to save the changes?" & vbCrLf & _
"Click Yes to Save or No to Discard changes."
' Display the message box.
If MsgBox(strMsg, vbQuestion + vbYesNo, "Save Record?") = vbNo Then
Me.Undo
End If
' Check the user's response.
'-- You most certainly do *NOT* want to cancel this event!
' If iResponse = vbNo Then
' ' Undo the change.
' DoCmd.RunCommand acCmdUndo
'
' ' Cancel the update.
' Cancel = True
' End If
End Sub