How to Recover a Corrupted FoxPro for Macintosh .DBF File

Last reviewed: May 17, 1996
Article ID: Q145670
The information in this article applies to:
  • Microsoft FoxPro for Macintosh, versions 2.5b, 2.5c, 2.6a

SUMMARY

Error messages are sometimes displayed when trying to open a FoxPro for Macintosh .dbf file. These errors usually indicate that FoxPro has detected a problem in the header of the .dbf file and cannot open the file. This article discusses some alternatives to opening the corrupt .dbf file directly in FoxPro.

MORE INFORMATION

Note: The methods described here do not apply to index files (.CDX). If a table is indexed, these methods, if successful, will only recover the data in the .DBF file. The corresponding index file (.CDX) will not be recovered.

In general, when you try to open a corrupt .dbf file, one of the following error messages appears:

   Not a table/DBF

   Memo file is missing/invalid

There is no way within FoxPro to recover a corrupted database. Therefore, it will be necessary to try to open the .dbf using other Macintosh applications.

Method One: Attempt to Open the .DBF File by Using Microsoft Excel 5.0

  1. Start Microsoft Excel 5.0 for the Macintosh. From the File menu, choose Open. In List Files of Type box, choose All files.

  2. Locate the corrupted .dbf file, select it, and choose Open. If Microsoft Excel can open the file without an error, it will be converted to a Microsoft Excel spreadsheet.

  3. To save to a .dbf format in Microsoft Excel, choose Save As from the File menu. In the Save File as Type box, choose DBF 4. This new file can simply be opened in FoxPro as a table/DBF.

Method Two: Attempt to Use Microsoft Word 6.0 to Open the .DBF File

  1. Start Microsoft Word 6.0 for the Macintosh. From the File menu, choose Open. In the List Files of Type box, choose All Files. Then locate the corrupt .dbf file, and choose Open.

    NOTE: If Word can open the file without an error, the data is now a Word document in a table format, which FoxPro cannot read. To get this data into a format FoxPro can read, follow the steps below:

  2. To get this data into a format that FoxPro can read, click somewhere in the table. From the Table menu, choose Select Table. This should highlight the entire table.

  3. From the Table menu, choose Convert Table to Text. Then select Commas, and choose OK.

  4. From the File menu, choose Save As. In the Save File as Type box, choose Text Only.

  5. Create a table in Microsoft FoxPro for Macintosh by choosing New from the File menu. Select Table/DBF as the file type.

  6. Enter the appropriate field name, type, and width to correspond with each field in the text file saved in step 4.

  7. With this new table open, choose Append From on the Database menu. In the File Type list, choose Delimited with Commas. Click the From button, and locate the text file created in step 4. Click OK, and then click the Append button.

NOTE: To check if the FoxPro/dBASE converter is installed, look for the FoxPro-dBASE converter in the Word Extensions folder under the Microsoft Word 6 folder.

Method Three: Look for Backup (.BAK) Files of the .DBF Files in FoxPro

Use File Find in the Macintosh Finder to check the hard disk for the existence of an old .dbf file name with a .bak extension. If one exists, then in FoxPro, choose Open from the File menu. Select Table/DBF in the Type list box, and select the All Files check box. Find the .bak file, and choose Open. The data in this table will probably be old, but it could be better than no data.

Most other attempted recoveries are going to require a third-party utility to repair the database. Unfortunately, the majority of these utilities run only on IBM compatible PCs, so the corrupted .dbf file would have to be copied to a PC for the recovery process.

For more information, please see the following articles in the Microsoft Knowledge Base:

   ARTICLE-ID: Q87665
   TITLE     : Utilities to Repair Corrupt Memo Field Data

   ARTICLE-ID: Q87688
   TITLE     : "Not a Database File" Error Using a Database File


Additional reference words: 2.50b 2.50c 2.60a FoxMac
KBCategory: kbtool kbhowto
KBSubcategory: FxtoolDbtabledes



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: May 17, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.