Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
On error do .... creates problems
Message
From
06/06/2010 13:49:11
 
 
To
05/06/2010 12:18:56
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01467471
Message ID:
01467567
Views:
53
Thanks TC i just tried your code. BTW Nothing actually appears as an error because there is no error, simply that vfp asks me what databse table i want to open. That being said however, with your code in place, the task that normally fails did not invoke the VFP window this time around and the files were found. I don't know if that tells you anything.

k

>>I have a problem that has just surfaced and have found the source of the problem but not a workable solution nor a why.
>>
>>1) When i set error to default (on error) - everything works fine. In my first program i open a database to inspect for information thus
>>(close all databases)
>>use mydata
>>do something
>>
>>Here's the problem
>>2) When i set error to a program (example on error do erroralert.)
>>(close all databases)
>>use mydata
>>do something
>>
>>the program cannot find the database and a window opens asking to select the database to open. It opens the correct directory, the database is there clearly visible, but i have to manually select it. Same thing when i try to copy databases - cannot find the database. There is NO error message that comes up - my error handing program does not even kick in. It's like it can't make the connection between the written program instruction and the database it is instructed to open.
>>
>>Yet set errror to default, and everything works fine.
>>
>>Why have i survived all these years without this problem - there is the only new aspect i have created and that is a .CDX for auto-complete. Could it be this is interfering with the search for database yet why does it not have the problem when the error is at default.
>>
>> My current solution is to simply accept default error - not a practical one since default pops out of the program when an error occurs.
>>
>>Any ideas??
>>
>>many thanks if you can help me out of this.
>>
>>K
>
>What message do you receive if you try this:
>
>
>*--Use this simple error handler to read the message
>ON ERROR DO OnErrorHandler WITH ERROR(), MESSAGE(), MESSAGE(2)
>
>*--Add this function to your main program
>FUNCTION OnErrorHandler(lnErr, lcMsg, lcMsgMore)
>
>IF TYPE("lcMsg")<>"C"
>    lcMsg = ""
>ENDIF
>IF TYPE("lcMsgMore")<>"C"
>    lcMsgMore = ""
>ENDIF
>IF TYPE("lnErr")<>"N"
>    lnErr = 0
>ENDIF
>
>MessageBox('Error ' + TRANSFORM(m.lnErr) + ;
>       ', "' + m.lcMsg + '" handled by ON ERROR routine.' + ;
>       ' More info: ' + m.lcMsgMore)
>
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform