PRB: Resolving "Structural CDX File Not Found" Error

Last reviewed: April 29, 1996
Article ID: Q92349
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, version 3.0
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, and 2.5a
  • Microsoft FoxPro for Windows, versions 2.5 and 2.5a

SYMPTOMS

Issuing a USE <file> command causes a "Structural CDX file not found" error to occur.

CAUSE

The associated structural .CDX file is not present in the current directory and SAFETY is on.

RESOLUTION

Use one of the following three methods to remove the reference from the CDX file and allow FoxPro to open the DBF file:

  1. Choose the Ignore button instead of the Cancel button. FoxPro removes the reference to the structural .CDX file from the .DBF file header and displays a message to indicate that the reference was removed. FoxPro opens the database file after removing the reference.

  2. Use SET SAFETY OFF to suppress the error message. However, because this method disables the file-protection facility, no warning is displayed when a file may be overwritten.

  3. Use an ON ERROR statement to trap the structural .CDX file error. With the code below, FoxPro can automatically remove the reference without displaying an error message.

          SET SAFETY ON                    && Enable file protection.
          USE customer                     && Open a DBF file.
          INDEX ON city TAG city ADDITIVE  && Create structural CDX file.
          CLOSE ALL                        && Close all files.
          DELETE FILE customer.cdx         && Remove CDX file.
    
          ON ERROR WAIT WINDOW "REMOVING REFERENCE AUTOMATICALLY" NOWAIT
          *** Trap the error and print a message
    
          USE customer
          *** Invoke the ON ERROR routine to automatically remove the
          *** reference.
    
          WAIT WINDOW "OK to issue USE <file> now !" NOWAIT
    
          ON ERROR
          *** release the ON ERROR statement
    
       NOTE: FoxPro does not open any files after the ON ERROR statement
       removes the reference. The user must issue the USE <file> command
       again to access the information in the .DBF file.
    


Additional reference words: VFoxWin 3.00 FoxDos FoxWin 2.00 2.50 2.50a
suppress missing
KBCategory: kbprg kbprb kbcode
KBSubcategory: FxprgGeneral


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