When working with an Access database, events such as abrupt system shutdown in the middle of a write operation, virus attack, drive errors, etc., may leave the database (.ACCDB/.MDB) files damaged (corrupted).
A corrupted database file may not open at all, or it may generate random errors identifying corruption. Whatever be the case, it is necessary that the issue is resolved at the earliest to avoid downtime and data loss.
Methods to Fix Corrupted Microsoft Access Database
Following are the methods that can be used to repair corrupt Access database:
Method 1: Use MS Access ‘Compact and Repair’ Utility
NOTE: If you have already tried compacting and repairing the database but the issue still persists, skip to the next method.
MS Access has a built-in utility, called the ‘Compact and Repair’ utility, which helps in compacting and repairing database files. The utility not only fixes the corrupt database but also helps enhance the performance of the database.
If you want to know more about Compact and Repair utility, click here.
The steps to compact and repair a database may vary depending on whether the database is accessible (i.e., it can open) or inaccessible.
Repairing an Open Database by using Compact and Repair
- Click File > Info.
- Choose the Compact & Repair Database.
MS Access will now create and open a copy of the compacted and repaired database.
Repairing Inaccessible Database by using Compact and Repair
- Launch your MS Access application.
- Double-click Blank desktop database.
Figure 1 – Open Blank Desktop Database
- A blank database gets displayed. Close the db table by clicking the cross (X) sign.
Figure 2 – Close the Database Table
- Go to Database Tools, and select the Compact and Repair Database option on the Tools menu.
Figure 3 – Select Compact and Repair Database
- In Database to Compact From the dialog box, browse the database you want to compact and repair and double-click it.
A copy of the compacted and repaired DB will get saved in the same location where the original db resides.
Method 2 – Use Microsoft Jet Compact Utility (JETCOMP.exe)
Note: This utility only works for Access database .mdb files.
If you’re using Access 2010 or an earlier version, running the JETCOMP.exe utility may help in recovering the corrupt database (MDB) file that even the MS Access built-in tool (discussed in Method 1 above) cannot recover.
Steps to use the Jet Compact Utility to repair MDB file are as follows:
Step 1: Download the JETCOMP.exe package available for download in Microsoft Download Center.
Step 2: In the dialog box that appears, type the location where you wish to save the JETCOMP.exe file or click Browse to select the location. Click OK.
Figure 4 – Jet Compact Utility 4.0
Step 3: Browse to the location where you saved the extracted .exe file, and search for JETCOMP.
Step 4: Double-click the JETCOMP option.
Figure 5 – Open JETCOMP
Step 5: In the window that pops-up, click the three dots under ‘Database to Compact From (Source)’ to browse and choose the MDB file you want to fix.
Figure 6 – Select Database to Compact
Step 6: Next, click the three dots under ‘Database to Compact Into (Destination)’ to choose the location where you want to save the recovered file.
Step 7: Select one of the options under Additional Compact Options.
Step 8: Click Compact.
The corrupt Access database (MDB) file will get repaired.
If none of the above methods works use an Access Database Repair tool such as Stellar Repair for Access to fix the corrupted Microsoft Access database and restore its data. The tool can handle all types of Access database corruption errors. It recovers all the database objects, including tables, deleted records, macros, indexes, linked tables, etc.
Workarounds to Fix Corrupted Microsoft Access Database
There are a few workarounds you can try to repair and recover a damaged database:
1. Delete the Access Database Lock Files (ACCDB/LDB)
When opened for shared use, Access automatically creates a lock file to keep a track of all the users accessing the DB. The file extension for ACCDB database files is “.laccdb” and the “.ldb” file extension is used for MDB files. The “.laccdb” or “.ldb” lock file gets automatically deleted when a user exits the MS-Access program.
The lock file won’t be deleted if a user is still logged on to the database. This may prevent you from accessing that DB. Try deleting the .accdb/.ldb file and check if you can access the database.
2. Import Objects to a New Database
By importing the objects from the corrupt database to a new database, you may be able to recover the damaged DB. To do so, follow these steps:
- Open a Blank desktop database (refer to Figure 1).
- Click External Data > Access.Figure 7 – External Data Option
- From the Get External Data – Access Database window, click browse to select the corrupt db, and then click OK.Figure 8 – Get External Data
- From the Import Objects dialog box, select the tab corresponding to the objects you want to restore. For example, click the ‘Forms’ tab to import forms from the source (corrupted) db into the new one.NOTE: To restore all the database objects, click the ‘Select All’ button.Figure 9 – Import Objects Window
- Click OK to finish importing the selected objects into the new database.
The ‘Compact and Repair’ utility is a default method that can be used to fix corrupted Microsoft Access Database. If you are using an Access database .mdb file, you can also try using the JETCOMP.exe to recover data from the damaged DB. Also, there are a few workarounds that may help recover the corrupt database files (as discussed in this post).
But, if you fear losing crucial database files, use an Access database repair software such as Stellar Repair for Access to fix the corrupt Access database (.ACCDB/.MDB) files and recover all the db objects. Unlike manual solutions, this software repairs and restores the db while keeping its data intact. Do check out our site Techdee for more guide related articles.