How to Ask Access Users to Confirm Changes Before Saving a Record
Question details
The user wants to display a confirmation prompt when navigating away from or closing a modified record in a Microsoft Access form, giving them the option to save, undo, or cancel.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Modifying a record within a bound Microsoft Access form where automatic saving is the default behavior.
- Observed behavior
- The user needs to intercept the default auto-save behavior in Access so that changes are explicitly confirmed or discarded before the record is updated.
Ensure your Microsoft Access form is a bound form (directly connected to a table or query) and that you have basic familiarity with the VBA editor before modifying form events.
Use the Form's Before Update Event with VBA
By adding a VBA script to the Before Update event, you can trigger a message box that intercepts the default auto-save behavior, allowing users to choose whether to save, undo, or cancel.
Microsoft Access automatically saves record changes when you navigate to a new record or close a form. Using the Before Update event gives you full control to interrupt this process.
This method applies primarily to bound forms, which require only a small amount of VBA to override default database behaviors.
Right-click your targeted form in the Access navigation pane and select 'Design View' from the context menu.
Press F4 to open the Property Sheet. Ensure the 'Selection type' at the top is set to 'Form'. Navigate to the 'Event' tab and locate the 'Before Update' property.
Click the ellipsis (...) button next to the 'Before Update' field, select 'Code Builder' from the prompt, and click OK. This will open the VBA Editor.
Inside the Private Sub Form_BeforeUpdate(Cancel As Integer) block, insert the following code: Select Case MsgBox("This record has been modified. Do you want to save changes?", vbYesNoCancel + vbQuestion) Case vbYes ' Let Access save the record Case vbNo Me.Undo Case vbCancel Cancel = True End Select
Save your VBA code, close the editor, and switch your form back to 'Form View'. Edit a record and attempt to navigate to the next record to ensure the confirmation prompt appears.

Looking for a Free, Powerful Alternative for Everyday Office Tasks?
While Microsoft Access is a specialized tool for complex databases, WPS Office provides a lightweight, highly compatible, and completely free alternative for your daily document, spreadsheet, and presentation needs.
- 1. Download the Installer: Visit the official WPS Office website and download the free installer for your operating system.
- 2. Install WPS Office: Run the downloaded file and follow the simple on-screen instructions to complete the installation.
- 3. Start Creating: Open WPS Office to instantly begin working on your documents, spreadsheets, and presentations with full Microsoft format compatibility.

Frequently Asked Questions
What is a bound form in Microsoft Access?
A bound form is directly connected to a data source, such as a table or a query. Any edits made in a bound form automatically update the underlying data, which is why events like Before Update are crucial for controlling saves.
Can I use macros instead of VBA for a confirmation prompt?
Yes, you can use the Before Update macro event with a MessageBox action. However, VBA offers more precise control, such as easily integrating the 'Undo' and 'Cancel' behaviors through a Select Case statement.
Why does Access save records automatically without asking?
Access is designed as a real-time database management system. To ensure data integrity and concurrent multi-user access, it commits changes to the disk as soon as you move to another record or close the form.
What does 'Cancel = True' do in the VBA code?
Setting 'Cancel = True' aborts the Before Update event. This prevents the form from saving the record and stops the user from navigating to a different record or closing the form until they resolve the unsaved changes.




