To retrieve your data from a Corrupt Microsoft Access MDB

[ Corrupt MDBs | AccessMain ]    (Updated 2010/10/23)

Make a backup! preferably on another computer or CDR as a there is a slight possibility the hard drive in question is failing
then try the following
Delete the LDB file if it's present.  If you can't delete it either someone is still in the MDB or that the server has a lock on the file due to abnormal termination.  You then may need to reboot the server.  However ensure you double check the locks to ensure no one has the MDB locked as abruptly terminating the connection can cause more corruption.
Rename the file to ensure that no one is somehow using the file. (You may need to exit LDBView even though it has given you the message stating there are no users accessing the MDB.)   This will also ensure users don't somehow manage to get into the file and make things worse.
Ensure you have the latest SRs, SPs and Jet SPs for your version of Access.  It may be possible than an update, especially in Jet, may allow you to repair a file.  See the MS Fixes page for a list of such.
Try repairing using the Jetcomp utility. KB 295334 - ACC2002: Jet Compact Utility Available in Download Center
Import from the corrupt MDB.
    (If importing works then use Michka's SysRels utility to copy the table relationships layout window.)
Open the MDB from a  newer version of Access.  One posting specifically stated "I was allowed to make changes to a #Error value in Access 2002, and save it successfully, something that I cannot do in Access 97"  Then convert the MDB back to the original version of Access. If you have converted back to Access 97 double check though that the references are set to DAO 3.51 .   Ctrl+G >> Tools >> References   (Changed2003-04-26)
open the MDB from ODBC.  One newsgroup posting mentions repairing via ODBC worked for him..
open the MDB using MSQuery from within Excel (see Q304561 ACC2000: Using MS Query to Recover Data from a Damaged Database)

If you can open the MDB but can't compact it try the code at ACC97: Sample Code to Import All Database Objects - 298176 or Q298174 ACC2000: Sample Code to Import All Database Objects.  You may discover specific corrupted objects which you will need to bypass and import those objects from a backup.

You may be able to read the data only using ODBC or from within Excel but you can't import the tables directly.  In which case import the table definitions from a backup of your database.  See the Options button in the Import Objects dialog box.    Then you can cut and paste the data into the tables.  If you have relationships defined you can either delete the relationships and recreate them later or insert the data in relational sequence.  By relational sequence I mean copying parent tables and then the child tables.   This can be somewhat difficult to determine if the database is very complex.

VBA Weirdness

Access seemed to continue to run an erased function that had been replaced with a new function of the same name in a new module of the same name as the old module.  Michael Kaplan's answer "Turning off compile on demand will make this never happen".

Corrupt record(s) within tables

Relationships won't import

Try importing into a new MDB but make sure you don't attempt to import the relationships.  You will need to deselect the Relationships check box once you've clicked the Options command button.  You'll have to rebuild them but what else can you do?

Try using Michka's SysRels utility to copy the layout of the relationships window from a backup.  Or use Save Restore Modify Relationship Window.  While you will still need to spend a lot of time clicking and dragging relationships this will save a lot of time.

Verify the number of records in all the tables

It's possible that part of the repairing, compacting and/or importing process may silently ignore some records.   Thus always double check that all the tables have the number of records you expect.

Also check for the existence of the MSysCompactErrors table, and review its contents. If anything doesn't make any sense or it looks like you've lost records then send your MDB off to a repair company.

[ Corrupt MDBs | AccessMain ]

Auto FE Updater   Auto FE Updater distribute new and updated Front End databases to your users with several mouse clicks.

Wrench and gear Granite Fleet Manager - the best designed fleet maintenance tracking and management system available

Comments email Tony  Search Contact Tony's Blog Privacy Policy Table of Contents

Website copyright 1995-2013 Tony Toews