How an ON ERROR Routine Affects the Error Event (136689)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 3.0

This article was previously published under Q136689

SUMMARY

This article describes how an ON ERROR routine affects the Error event. In particular, it examines the condition under which the Error event is called.

MORE INFORMATION

The following information comes from the Help file:

The Error event allows an object to handle errors. This event overrides the current ON ERROR routine and allows each object to trap and handle errors internally.

NOTE: The Error event is only called when the error occurs in code.

If a second error occurs in the Error event procedure while it is handling an error, Visual FoxPro calls the ON ERROR routine. If no ON ERROR routine exists, Visual FoxPro suspends execution and reports the error as if no Error event or ON ERROR routine existed.

Note that the Error method of a given object is called when an error occurs in a method of that object. So, if an error occurs in the Form1.cmdOK.Click event procedure, the Form1.cmdOK.Error method is called if it exists. The Form1.Error method is not called unless an error occurs in a method or event procedure belonging to the form such as Form1.Activate or Form1.Resize.

Modification Type:MajorLast Reviewed:2/15/2000
Keywords:KB136689