Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Structural .CDX file is not found ERROR
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01530069
Message ID:
01530076
Vues:
56
>Hi Gang!
>
>The code below used to work just fine in a method.
>
>
>SELECT regtrans
>USE
>ERASE .\DBF\REGTRANS.CDX
>
>SELECT 0
>USE REGTRANS EXCLUSIVE
>PACK
>
>
>But as of this morning, it crashed on the USE REGTRANS EXCLUSIVE line....
>
>with error 1707 - "Structural .CDX file is not found."
>
>Why did it not fire this error before??? Why is it doing it now??? I am confused!
>
>Thanks!

Ok... more info .... after futher testing..... I found that the code works if called from the origianl program where an

ON ERROR DO POSERROR WITH PROGRAM(), ERROR(), MESSAGE(), MESSAGE(1), LINENO()

is called and this is in POSERROR.PRG
PROCEDURE POSERROR
PARAMETERS eProg, eERROR, eMESSAGE, eMESSAGE1, eLINENO

LIST MEMO TO ERROR.FLE NOCONSOLE

LIST STATUS TO STATUS.FLE NOCONSOLE

eFile = ALIAS()

SELECT 0
USE POSERROR

APPEND BLANK
REPLACE DATE     WITH DATE(),;
        TIME     WITH TIME(),;
        PROGRAM  WITH ePROG,;
        ERROR    WITH eERROR,;
        LINENO   WITH eLINENO,;
        MESSAGE  WITH eMESSAGE,;
        MESSAGE1 WITH eMESSAGE1
USE

IF NOT EMPTY(eFile)
	SELECT (eFile)
ENDIF

ON ERROR

RETRY
but the error occurs when I run the code from ANOTHER startup program (a NEW one), that calls the offending code from a FORM called FRMNIGHT which has an ERROR event !!!

Here is the code in the ERROR event...
LPARAMETERS nError, cMethod, nLine

IF nError = 1
	WAIT WINDOW "Error is Files does not exist" nowait
	WAIT clear
ENDIF
So, is the ERROR event overriding the ON ERROR procedure, and making it where the automatic resolving of the link is done impossible?

How can I get the ON ERROR method to work and then allow the offending code to work?

Here is some info from Microsoft on the Structural .CDX file is not found" is not found error.. and how to resolve it...
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.
Tommy Tillman A+ NetWork+ MCP
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform