PRB: ON ERROR Not Called When Trigger Fails in Browse or Grid (130131)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 3.0
This article was previously published under Q130131 SYMPTOMS
Triggers that fail while working interactively in a Browse or a Grid are
not captured by the ON ERROR Routine. Instead the Default Message, "Trigger
Failed" is displayed. This seems inconsistent with what is documented in
the Help file and in the "Language Reference" manual under CREATE TRIGGER.
CAUSE
This is because the firing of a trigger in the context of a Browse or Grid
leaves the control in the hands of the Browse or Grid after the trigger
fires. If the normal error handler (the one that allows for ON ERROR) is
called, the option of RETRY becomes applicable. But because the Trigger
code finished executing, the last command to be retried is the Browse.
Therefore, choosing the RETRY option results in two problems:
- The Browse is retried instead of the trigger.
- A new Browse or Grid is instantiated.
This scenario could result in an infinite loop.
WORKAROUND
One way to work around this problem is to trap the failed triggers at the
Engine level, not at the Object level. In this case, put the appropriate
code to handle erroneous conditions in the trigger itself. This workaround
is shown below in the "More Information" section.
STATUS
This behavior is by design. We are researching this design decision and
will post new information here in the Microsoft Knowledge Base if it
becomes available.
Modification Type: | Major | Last Reviewed: | 2/9/2000 |
---|
Keywords: | kbcode KB130131 kbAudDeveloper |
---|
|