The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
How to: Prompt a User Before Saving a Record
Access Developer Reference
The following example illustrates how to use the BeforeUpdate event to prompt users to confirm their changes each time they save a record in a form.
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?" & Chr(10)
strMsg = strMsg & "Click Yes to Save or No to Discard changes."
' Display the message box.
iResponse = MsgBox(strMsg, vbQuestion + vbYesNo, "Save Record?")
' Check the user's response.
If iResponse = vbNo Then
' Undo the change.
' Cancel the update.
Cancel = True
Was this page helpful?
Your feedback about this content is important. Let us know what you think.