Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
On error do .... creates problems
Message
From
06/06/2010 03:14:36
 
 
To
05/06/2010 12:18:56
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01467471
Message ID:
01467535
Views:
47
thank you for the suggested test TC - i will try this over next couple of days and report back to you what has happened.

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
Reply
Map
View

Click here to load this message in the networking platform