Fix a VBA Project Error When Opening a Microsoft Access Database
Question details
The user needs to recover an Access database without losing its VBA code and other objects.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Opening an Access database that contains VBA code, queries, forms, reports, and other objects.
- Observed behavior
- Access says the VBA project cannot be read and offers to delete it. Deleting the project could remove code, and other database objects may also be damaged.
Locate the most recent working copy of the database and use a separate copy for recovery attempts. Do not accept the prompt to delete the VBA project if you need to preserve its code.
Import recoverable objects into a new Access database
Use a working copy or a copy of the affected database to transfer objects into a clean file, then rebuild anything that cannot be imported.
In Access, select File > New > Blank database, enter a file name, and select Create.
Open the External Data tab and choose New Data Source > From Database > Access. Browse to a working copy of the original database, or a copy of the affected file if no working copy is available, and choose to import objects into the current database.
In the Import Objects dialog, select the needed tables, queries, forms, reports, macros, and modules on their respective tabs, then select OK. If an import fails, try importing objects in smaller groups to identify damaged items.
Open the imported objects from the Navigation Pane and test their behavior. Recreate any damaged or missing queries, forms, reports, or code from a working copy or other available source.

Work with exported database data in WPS Office
WPS Office is a free, lightweight Office alternative with a familiar interface and support for common Microsoft Office formats, making it easy to move exported data into spreadsheets. It does not repair Access databases or replace Access VBA.

Frequently Asked Questions
Should I let Access delete the unreadable VBA project?
Avoid choosing Delete if you need the code. Deleting the project can remove code from modules, forms, and reports. Instead, attempt recovery using a copy of the database.
Where can I import objects into a new Access database?
In the new database, go to External Data > New Data Source > From Database > Access. Select the source file and choose to import objects into the current database.
What if some queries or modules will not import?
Try selecting smaller groups of objects in the Import Objects dialog to identify the damaged items. Recreate them from a working copy or other available source if they cannot be imported.
Can WPS Office repair an Access VBA project?
No. WPS Office does not repair Access databases or Access VBA. It can open compatible spreadsheet files if you export recoverable data from Access for analysis.




