Access Database Repair


How To Fix a Corrupted Access Database

Most Access Database Corruptions can be repaired by following these simple steps. If you’re planning to give me a call regarding database repair, I suggest you first try this procedure before you and I get started.

If you’re difficulty getting through this procedure, call me. I’m at (310) 714-9669. If we’re able to resolve the difficulty you’re having in a short period of time, which is quite likely, there will be no charge for the call.

1. Read My Article on Preventing Access Database Corruption

It may give you a clue as to what may have happened to create this problem in the first place. And more importantly, how to minimize the risk of this happening again. On the note of prevention, you may also wish to take advantage of my Access Database Design Analysis Services.

2. Make sure everyone is out of the database

Walk around from desk to desk and make sure nobody is using the database. Check the folder location of both the front end and back end databases to make sure the .laccdb or .ldb files are not present in the subject database’s folder.

3. Perform a Backup!

The possibility exists that as you repair your database you will actually make things worse. Be sure to create a copy of your database and either store it on another drive or zip the file and then send it to yourself in an email. (I like using gmail or yahoo mail for such purposes, as this will store a copy of your file online.)

If you perform a backup, you’ll be able to take multiple shots at recovery if need be.

4. Turn Off AutoCorrect

There are a number of Access AutoCorrect problems that cause problems and or failures within your database. Make sure that AutoCorrect is turned off in your database and leave it off.

  • Access 2010: File, Options, Current Database. Scroll down to Name AutoCorrect Options
  • Access 2007: Click the “orb” in the top left-hand corner of Access, Access Options, scroll down and un-check Track Name Autocorrect Info
  • Access 2000 ~ 2003: Click on Tools, Options, look under the General tab

5. Delete the Locking Files

When you open Access, a temporary file is created (either yourdatabase.accdb, or yourdatabase.ldb). When you close Access, this file is automatically deleted.

If the computer is turned off while Access is still running, or if the database corrupts, the locking file may be left behind. Be sure to delete this file. If you cannot delete this file, be sure that everyone is out of the database. If the problem persists, try re-booting your computer.

6. De-compile and Re-compile the code

Most people aren’t aware of this step or its necessity. Sometimes Access confuses programming code that was typed into the program with code that had been “compiled” by Access into machine code. This is the most common form of corruption I’ve seen in Access 2007.

  • Copy the following line and paste it into notepad. It will need to be modified. “C:\Program Files\Microsoft Office\Office12\MSACCESS.EXE” ” /decompile “c:\MyPath\MyDatabase.mdb”
  • The first part (in quotes) points to where the Access program itself is located on your computer. You might have to poke Program Files to find it, but the path will be similar to what you see.
  • The last part (second set of quotes) points to your access database.
  • Modify this command as needed
  • Copy it into your clipboard
  • Press the key combination of [Window] R (the window key is usually located between the left-hand-side Control and Alt keys on your keyboard).
  • Hold down the Shift Key and click OK. Holding the shift key will prevent Access from running startup code.
  • Once Access opens, press the key combination [COTROL] G. This opens the code window
  • Click on the Debug Window, then click Compile
  • Close the Code Window
  • Do not close Access yet, there is one more step to perform…

7. Repair and Compact the database

  • Access 2010: Click on Compact and Repair Database on the Tools Ribbon
  • Access 2007: Click on the Orb, Manage, Compact and Repair Database
  • Earlier Versions: Click on Tools, Database Utilities, Compact and Repair Database

To Conclude

Following this procedure, in full, usually does the trick. If not, you should strongly consider restoring a previous backup. There are further steps that can be taken to recover a database from more serious problems but they are beyond the scope of this article.

Additional Resources

Comments are closed.