PRB: Resolving "Structural CDX File Not Found" Error (92349)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 3.0
  • Microsoft FoxPro for MS-DOS 2.0
  • Microsoft FoxPro for MS-DOS 2.5
  • Microsoft FoxPro for MS-DOS 2.5a
  • Microsoft FoxPro for Windows 2.5
  • Microsoft FoxPro for Windows 2.5a

This article was previously published under Q92349

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.

Modification Type:MajorLast Reviewed:12/3/2003
Keywords:kbcode KB92349