ACC2000: How to Repair a Damaged Database

ID: Q209137


The information in this article applies to:

Novice: Requires knowledge of the user interface on single-user computers.

This article applies only to a Microsoft Access database (.mdb).


SUMMARY

Environmental factors, such as power outages and power fluctuations, improper closing of Microsoft Access, and disk or network failures, may leave your database file damaged. The Repair and Compact utilities in Microsoft Access are useful tools for recovering and optimizing Microsoft Access database files. This article describes how to use these utilities and additional alternatives for repairing a damaged database file.


MORE INFORMATION

Although the steps outlined in this article are usually successful at recovering damaged database files, to safeguard your data, you should create a backup copy of your database file as often as is feasible for you.

Compact and Repair Utility

The Compact utility eliminates empty space in an existing database. It does so by creating a new destination database and copying each object in the old database to the new one. If you choose to compact the database into the original database name instead of a new database, the Compact utility creates a temporary database, exports all the objects from the original database into the temporary database, removes the original database, and renames the temporary database to the original database's name.

The Repair utility tries to repair only the tables, queries, and indexes in the database. It does not try to repair damaged forms, reports, macros, or modules.

Recovering a Damaged Database

The following steps outline a general method for repairing a damaged database:
  1. Back up the damaged database (.mdb) file.


  2. Delete the .ldb file if it is present. You should close the corresponding .mdb file before you delete this file.

    The .ldb file is used to determine which records are locked in a shared database and by whom. If a database is opened for shared use, the .ldb file is created with the same name as the corresponding database (.mdb). For example, if you open (for shared use) the Northwind.mdb sample database in the c:\Msoffice\Access folder, a file called Northwind.ldb is automatically created in the same folder. The .ldb file is automatically deleted after the last user has quit the database with two exceptions -- when the last user does not have delete privileges to the folder that contains the .mdb file, or when the database is corrupted.

    For additional information about .ldb files, please see the following article in the Microsoft Knowledge Base:


  3. Q208778 Introduction to .ldb Files
  4. Run the Compact utility as follows:


    1. If the database is open, close it.


    2. On the Tools menu, point to Database Utilities, and then click Compact and Repair Database.


    3. In the Compact Database From dialog box, select the file that you want to compact, and then click Compact.


    4. In the Compact Database Into dialog box, enter a new file name and click Save.

      If the compact and repair does not succeed, you will receive a message stating so. This means the damage is so severe that it cannot be corrected.


  5. If the previous steps fail to recover your damaged database, try creating a new database and importing the objects, one-by-one, from the old database to the new one. Then re-create the relationships. This technique resolves problems with damaged system tables in the database.

    Note that you are not able to import data access pages with the Import Wizard. Instead, open an existing data access page in the new database. To do so, follow these steps:


    1. In the Database window, click Pages under Objects.


    2. Click the New button.


    3. In the New Data Access Page dialog box, click Existing Web page, and then click OK.


  6. If the damage is in a form or a report, the damage can be either in the form or the report itself or in one or more controls on the form or the report. You can delete the form or report and import it from the backup copy of your database or use one of the following options:


  7. If the damage is in a macro or a module, the damage can be in the macro or the module itself or in the contents of the macro or the module. You can delete the macro or the module and import it from the backup copy of your database or use one of the following options:


If you cannot repair the database with these steps, the database is probably damaged beyond repair. If this is the case, you should restore your last backup database or re-create the database.

As a final alternative, some consultants may provide a Microsoft Access database repair service. Because this is such a specialized service, the most efficient way to locate a consultant is to post a message in the Microsoft Access "Third Party and User Groups" Internet newsgroup, which has the following newsgroup address:
microsoft.public.access.3rdpartyusrgrp
For additional information about Microsoft Access Internet newsgroups, please see the following article in the Microsoft Knowledge Base:
Q150057 Microsoft Access Newsgroups Available on the Internet.


REFERENCES

For more information about repairing databases, click Microsoft Access Help on the Help menu, type "repairing" in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

Additional query words: corrupt corruption


Keywords          : kbdta GnlBaddb GnlCmp 
Version           : WINDOWS:2000
Platform          : WINDOWS 
Issue type        : kbhowto 

Last Reviewed: May 13, 1999