Microsoft Access database corruption

From time to time, Microsoft Access databases may start to report errors. Forms won't open, Access will warn that the file is not a recognizable database. ("Unrecognized database format mymissioncriticaldatabase.mdb")

These and other scary messages can take the breath away, and depending on the severity, ruin an hour, a day or a week. Here are steps we take in escalating order:

1. Repair and compact the database. You have to be the sole person with the database open to do this. On Office 2003 and earlier, go to tools -> database utilities -> Compact and Repair. In Office 2007, click the Access icon in the upper left corner, then manage, then Compact and Repair.

2. If there is a back end, repair and compact that as well. If the database has had problems, do it two times in a row.

3. Make sure the code modules are compiled. Goto Modules, pick one, open in design view, and then from menu, Debug -> compile. Compact and Repair again.

4. If the database opens, but one form, report, or query fails with errors, open the table (on the back end of the database), sort it up and down, and look for a row that has all non-English characters, or question marks or pound signs. That row has degenerated (it may or may not be an actual data record). Delete it and do the compact and repair again. (If you are worried about losing that row, you may be able to recover it from a good, valid back-up by joining back to find the missing id.)

5. Those are the relatively quick and easy steps. Next: create an empty database and import everything from the corrupted database into it, and Compact and Repair and compile again. (Make sure you check the options in importing to ensure you have everything you need, such as import/export criteria, indexes and relationships) If things go sour after you have imported everything, you may have to do it incrementally until you find the table, query, form, report or code module that is messed up.

6. If you find yourself lost in step 5, you may need to export an offending table out to plain text, delete it from the database and re-import it, and then recreate indexes and relationships.

7. If things are happening exclusively with one user, reinstall Office on their desktop and investigate their networking setup. Preventative medicine around Access database corruption usually starts with hardware and network issues, which we will explore separately.