How to Fix Access VBA Events Not Running After Copying a Database
Question details
The user needs to restore VBA event procedures that fail to execute or reach breakpoints after copying an Access database to a new location.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Running an Access database after it has been copied or moved to a new folder, computer, or network drive.
- Observed behavior
- Standard Access macros continue to function, but VBA event procedures are blocked and do not trigger, even when event properties are correctly assigned.
Verify that Windows has not blocked the copied file. Right-click the database file, select Properties, and check the 'Unblock' box at the bottom of the General tab if it is present.
Add the Database Folder to Trusted Locations
This is the primary solution for computer-level security restrictions that block VBA execution while allowing safe macros to run.
Microsoft Access restricts executing unsafe actions and VBA code from untrusted locations to protect against malicious scripts. When you copy a database to a new directory, it loses its trusted status. Moving the database folder into an Access Trusted Location permits the VBA event procedures to run without interference.
Launch Microsoft Access. Click on 'File' in the top-left corner, select 'Options', and then navigate to the 'Trust Center' tab. Click the 'Trust Center Settings' button.
In the left-hand menu of the Trust Center dialog, click on 'Trusted Locations' to view all currently trusted directories.
Click the 'Add new location' button at the bottom. Browse to the specific folder where your newly copied database is stored.
If applicable, check the box labeled 'Subfolders of this location are also trusted'. Click 'OK' on all dialog boxes to save your changes.
Completely close the Access database and reopen it from the newly trusted location to test if the VBA event procedures are firing properly.

Verify References and Compile the VBA Project
Use this method to fix broken code dependencies or missing libraries that prevent events from compiling and running.
Use the Decompile Command Switch
Perform a decompile and recompile to clear corrupted execution states inside the Access database file.
Try WPS Office for Your Data and Macro Needs
While Microsoft Access is used for relational databases, many users rely on VBA macros and structured data tracking that can be managed efficiently with powerful spreadsheets. WPS Office is a lightweight, fully compatible suite that supports advanced data analysis and VBA macros in its Spreadsheet application at zero cost.
- 1. Download WPS Office: Visit the official WPS website to download the free installation package.
- 2. Install the Suite: Follow the simple on-screen instructions to install WPS Office on your computer in minutes.
- 3. Open Macro-Enabled Files: Launch WPS Spreadsheet and open your existing macro-enabled files to seamlessly continue your work with full VBA support.

Frequently Asked Questions
Why do my Access macros still work when VBA is blocked?
Standard Access macros often use predefined 'safe actions' which are permitted by default security settings. However, VBA code is classified as an 'unsafe action' and will be entirely blocked by the Trust Center unless the file is placed in a designated Trusted Location.
How do I know if Windows has blocked my Access database file?
When you download or copy a database from another computer, Windows may add a 'Mark of the Web' to the file for security. Right-click the file, select Properties, and look at the bottom of the General tab. If you see a security warning with an 'Unblock' checkbox, the file is currently blocked by Windows.
Will compiling the database bypass the security restrictions?
No. Compiling the database resolves issues related to syntax errors and broken library references, which can independently stop code from running. However, if the Trust Center is blocking execution because the folder is not trusted, compiling the VBA project will not bypass that security requirement.




