MS Access
One time or the other, probably someone could have lost data due to corrupt MS Access Database. However Not all corrupted Access database are irrecoverable. In most of the cases you can recover almost all the data from the corrupt MS Access Database. The Code below provides one possible alternative to recover data from certain (not all) types of corrupted MS Access Database.
Though MS Access comes with built in Compact and Repair tool, Not all corrupted data can be fixed using it.
If you are getting the following message,
"Microsoft Access has detected corruption in this file. To try to repair the corruption, first make a backup copy of the file. Then, on the Tools menu, point to Database Utilities and click Compact and Repair Database. If you are currently trying to repair this corruption then you will need to recreate this file or restore it from a previous backup."
You can try the code provided here below to recover data from the corrupted MS Access Database.
Imp: Make a copy of the Corrupted Database
Try this code only on the backup (Copied) file.
Please take backup even if your database is corrupted.
1. Create a blank database = "C:Recover_db.mdb"
2. Close and exit.
3. Create another blank database
4. Navigate to Modules Tab
5. Click on New
6. Paste the code provided below
7. Go to Menu Tools->References
8. Scroll down and Select "Microsoft DAO 3.6 Object Library"
9. Click OK
10. In Module Window Click on Recover_db() Function
11. Check database file names, after proper setup, Hit F5
12. Tables and data from corrupt database is recovered to new database C:Recover_db.mdb, Close all database, Open C:Recover_db.mdb, You will find your data here...
Also note that I have used C:Corrupt_db.mdb as the corrupted database file name, you will have to change it to your file name.
Please Note : This is one of the method to recover data. However I will not assure you that you can recover all corrupt database from this method. The solution may work for some database and may NOT work for others. Since the cause of corruption are several, the recovery method varies. This is only one such method.