PRB: Access 7.0 Database Corrupt After Calling RepairDatabase

Last reviewed: July 7, 1997
Article ID: Q167906
The information in this article applies to:
  • The DAO SDK included with: - Microsoft Visual C++, 32-bit Editions, versions 4.0, 4.1, 4.2, 5.0
  • The Microsoft Foundation Classes (MFC) included with: - Microsoft Visual C++, 32-bit Editions, versions 4.0, 4.1, 4.2, 5.0

SYMPTOMS

If you call CDaoWorkspace::RepairDatabase() or CdbDbEngine::RepairDatabase on a corrupt Access 7.0 database, it may result in a database that is so corrupt that it cannot be recovered.

CAUSE

The MSysObjects system table is corrupted.

RESOLUTION

You should always call CDaoWorkspace::CompactDatabase() before calling CDaoWorkspace::RepairDatabase() on an Access 7.0 database. It is a good idea to compact, repair, and backup your database frequently.

MORE INFORMATION

Sample Code

   /* Compile options needed: none
    */

   // The following code will repair the database C:\DB1.MDB
   // using the MFC DAO classes
    try
    {
        CDaoWorkspace::CompactDatabase( _T( "C:\\DB1.MDB" ),
            _T( "C:\\DB2.MDB" ) );
        CDaoWorkspace::RepairDatabase( _T( "C:\\DB2.MDB" ) );
    }
    catch( CDaoException* e )
    {
        AfxMessageBox( e->m_pErrorInfo->m_strDescription );
        e->Delete();
    }

REFERENCES

For additional information, please see the following article(s) in the Microsoft Knowledge Base:

   ARTICLE-ID: Q109953
   TITLE     : INF: How to Repair a Damaged Database

   ARTICLE-ID: Q158933
   TITLE     : PRA: Error "<Database Name> Isn't an Index in This Table"


Additional query words: Jet 3.0
Keywords : dbDAO kbcode kbprg MfcDAO
Technology : kbMfc
Version : 4.0 4.1 4.2 5.0
Platform : NT WINDOWS
Issue type : kbprb


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 7, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.