FIX: Index Doesn't Match Table When Opening dBASE Table

ID: Q114145

2.60    | 2.60
WINDOWS | MS-DOS kbprg kbfixlist kbbuglist

The information in this article applies to:

SYMPTOMS

When you attempt to use a dBASE IV (version 2.0) database, the following message is displayed:

   Index does not match table. Re-create index.

CAUSE

The index blocksize in dBASE was set to a size other than 1 or 2 (or 512 bytes) with the SET IBLOCK command. The index blocksize can also be set with the SET BLOCKSIZE command, which sets the blocksize for both memo files and index files.

RESOLUTION

IMPORTANT: Neither of the two methods (described below) to correct this problem will work if the database has one or more memo fields that were converted to FoxPro memo fields before the "Index does not match table" error message was displayed.

Method 1

To make the dBASE .MDX file readable by FoxPro, issue the following commands from the dot prompt in dBASE IV:

   USE <filename>
   SET IBLOCK TO 1
   COPY TO <newfilename> WITH PRODUCTION

This will make a new copy of the database and the index file with the correct index blocksize of 1 (512 bytes).

Method 2

If dBASE IV is not available, re-create the indexes as follows:

1. Delete the .MDX file.

2. Issue the following command:

      USE <filename>

3. Choose Ignore when you are warned "Structural CDX file not found."

4. Re-create the index tag(s) in FoxPro either by choosing Setup from the

   Database menu or by using the INDEX ON command (see page L3-571 in the
   "Language Reference").

STATUS

Microsoft has confirmed this to be a problem in Microsoft FoxPro for Windows and MS-DOS, version 2.6. This problem was corrected in Microsoft FoxPro for Windows and MS-DOS, version 2.6a.

MORE INFORMATION

The SET IBLOCK command sets the blocksize for new index files in blocks of 512 bytes. Valid values range from 1 to 63. Any value greater than 2 will cause the problem described above.

Steps to Reproduce Problem

1. In dBASE IV (version 2.0), issue the following commands:

      SET IBLOCK TO 3 && or SET BLOCKSIZE TO 3
      CREATE test
      * Add a field called 'ONE' that is Numeric, Width 5,
      * Decimals 0, Index 'Y'.
      USE

2. In FoxPro (version 2.6), try to open the database with this command:

      USE test

   You will receive the error message:

      Index does not match table. Recreate index.

3. In dBASE IV, issue the following commands:

      SET IBLOCK TO 23 && or SET BLOCKSIZE TO 23
      CREATE test2
      * Add a field called 'ONE' that is Numeric, Width 5,
      * Decimals 0, Index 'Y'.
      * Add a second field called 'TWO' that is type 'Memo'.

4. In FoxPro, try to open the database with this command:

      USE test2

   You will be asked the following:

      Convert MEMO file to FoxPro Format?
        This can later be reversed with
            COPY ... TYPE FOXPLUS

   Choose Yes. (If you choose No, the error message "Not a table/.dbf" will
   be displayed and the table will not be opened.)

   You will next be prompted with:

      Remove dBASE 'soft' carriage returns from memos?
         Choose Yes if all memos are normal text
         Choose No if any memos have binary data

   Choose Yes or No; it does not make a difference in the results.

   You will receive this error message:

      Index does not match table. Recreate index.

At this point, you must use Method 2 (described above) to re-create the indexes because the memo file can no longer be read by dBASE IV. (The COPY TO ... TYPE FOXPLUS command can only be issued once the database is opened.)

Additional reference words: FoxDos FoxWin 2.60 buglist2.60 mdx cdx re- create fixlist2.60a KBCategory: kbprg kbfixlist kbbuglist KBSubcategory: FxinteropDbase

Keywords          : FxinteropDbase kbbuglist kbfixlist
Version           : 2.60 | 2.60
Platform          : MS-DOS WINDOWS
Solution Type     : kbfix

Last Reviewed: October 22, 1997