MS-Access Tips for Serious Users

Provided by Allen Browne, allen@allenbrowne.com

A more recent version of this page is also available.


Database Corruption

Since the Access database is a single mdb file, you can lose everyting if it becomes corrupt. Some basic steps can lessen the chance of serious loss: adequate backup procedures, periodic compacting of the database, defragmenting the disk, and simply closing the database when not in use.

The most common cause

The single most common cause of corrupted Access databases in my experience is inelegant shutdown. This includes:

After every crash, perform this sequence:

  1. Make sure Access and other programs are not running.
  2. Delete any files in the temp directory. (Type SET at the DOS prompt if you are not sure where your temp directory is.)
  3. Delete any .ldb files in the data directory. These contain invalid locking information from before the crash.
  4. Run ScanDisk to check for logical disk errors. Windows 95b/98/ME users: The system automatically performs a ScanDisk after an inelegant shutdown. However, by cancelling that operation and performing step1 first, you are less likely to lose data if your file is cross-linked to a temp file. Windows 3.xx users: exit Windows to perform ScanDisk or (for DOS 5 and earlier) ChkDsk.
  5. If an mdb is corrupted, compact the database using a new name (creates a copy), then repair, and compact again.

Tips to prevent corruption

All Versions

Access 2 (Windows 3.xx)

Access 95

Access 97, 2000, 2002

Worst Case

If "repairing" does not fix the corruption, you may be able to create a new mdb file, and import most of the objects. This forces Access to re-create everything from scratch.


Home Index of tips Top