Error method interacting with other methods 
Author Message
 Error method interacting with other methods

NOt unrelated to my other questioning thread on buffering and
transactions:

If you have an Error method on a form and it is triggered by an error in
another method, is there any way of terminating the method where the
error is from within the Error method.

For example, I have a several REPLACE commands in say a click function
of a commandbutton. The first cannot lock the record and so calls the
Error method. In the Error method, I give the user the choice to wait
and retry or abandon. If they select abandon, the error method seems to
terminate and drop back to the next REPLACE in the Click function,
whatever I put in it, even QUIT.

Have I missed something obvious? By the way, I know that in the above
example I could try locking the record first and use RLOCKs return
value. It was just by way of an example.

--
Richard Candeland



Mon, 06 Aug 2001 03:00:00 GMT  
 Error method interacting with other methods
Richard,

If your CommandButton had it's own overridden Error() method it would trap
it's own errors. You can use the PROGRAM() function with numeric arguments
to find out the entire calling stack.

df    - (Microsoft FoxPro MVP)
http://www.geocities.com/ResearchTriangle/9834/

Quote:

>NOt unrelated to my other questioning thread on buffering and
>transactions:

>If you have an Error method on a form and it is triggered by an error in
>another method, is there any way of terminating the method where the
>error is from within the Error method.

>For example, I have a several REPLACE commands in say a click function
>of a commandbutton. The first cannot lock the record and so calls the
>Error method. In the Error method, I give the user the choice to wait
>and retry or abandon. If they select abandon, the error method seems to
>terminate and drop back to the next REPLACE in the Click function,
>whatever I put in it, even QUIT.

>Have I missed something obvious? By the way, I know that in the above
>example I could try locking the record first and use RLOCKs return
>value. It was just by way of an example.

>--
>Richard Candeland



Tue, 07 Aug 2001 03:00:00 GMT  
 Error method interacting with other methods


Quote:
>Richard,

>If your CommandButton had it's own overridden Error() method it would trap
>it's own errors. You can use the PROGRAM() function with numeric arguments
>to find out the entire calling stack.

>df    - (Microsoft FoxPro MVP)
>http://www.geocities.com/ResearchTriangle/9834/


>>If you have an Error method on a form and it is triggered by an error
>>in another method, is there any way of terminating the method where
>>the error is from within the Error method.

>>Have I missed something obvious?

David,

Thanks for your reply. It still does not answer my question, though.
I'll give you a hypothetical example.

I have a command button with code in its click event as follows:

REPLACE field1 WITH value1
REPLACE field2 WITH value2
IF value1 = 1
  * DO something
ELSE
  * DO something-else
ENDIF

If value1 is meant to be numeric but for some reason (sloppy programming
on my part if you like!) is not, then the first line of my click method
will fail and call my Error method (wherever it is defined).

I can probably work out in the Error method what is wrong and handle it.
But let's say, for arguments sake, that I can't. After all, how many
possibilities does one check for in the Error method. I wish to
gracefully abort the form I'm in. So I issue RELEASE THISFORM in my
Error method, it then finishes, control seems to be passed back to the
above CLick routine which then continues. Only when the CLick has run
its course does the form Release, possibly doing untold damage to my
data.

WHat I want to know is can I stop control going back to finish the
Click() method. How do I use PROGRAM() to help me do this.
--
Richard Candeland



Tue, 07 Aug 2001 03:00:00 GMT  
 Error method interacting with other methods
Richard.

You can't prevent the return to the Click method. You might want to go to
Doug Hennig's website at www.stonefield.com and read his white paper on
error handling.

df    - (Microsoft FoxPro MVP)
http://www.geocities.com/ResearchTriangle/9834/

Quote:

>I have a command button with code in its click event as follows:

>REPLACE field1 WITH value1
>REPLACE field2 WITH value2
>IF value1 = 1
>  * DO something
>ELSE
>  * DO something-else
>ENDIF

>If value1 is meant to be numeric but for some reason (sloppy programming
>on my part if you like!) is not, then the first line of my click method
>will fail and call my Error method (wherever it is defined).

>I can probably work out in the Error method what is wrong and handle it.
>But let's say, for arguments sake, that I can't. After all, how many
>possibilities does one check for in the Error method. I wish to
>gracefully abort the form I'm in. So I issue RELEASE THISFORM in my
>Error method, it then finishes, control seems to be passed back to the
>above CLick routine which then continues. Only when the CLick has run
>its course does the form Release, possibly doing untold damage to my
>data.

>WHat I want to know is can I stop control going back to finish the
>Click() method. How do I use PROGRAM() to help me do this.
>--
>Richard Candeland



Fri, 10 Aug 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. GetSourceHTML method (& others) returns nothing

2. Custom Form Method not visible from within ActiveX method

3. ON ERROR and Error methods

4. ON ERROR and Form Error Method

5. Form & error method

6. Capturing method info on errors?

7. Want Error to cause method to abort...

8. File is not Open error when editing/saving method code

9. Error w/ RANGELOW Method

10. TYPE() error in ACCESS method

11. Error Methods

12. Form Error Method

 

 
Powered by phpBB® Forum Software