PRB: ON ERROR Not Called When Trigger Fails in Browse or GridID: Q130131 3.00 WINDOWS
The information in this article applies to:
SYMPTOMSTriggers 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.
CAUSEThis 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:
WORKAROUNDOne 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.
STATUSThis 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.
MORE INFORMATION
Steps to Reproduce Behavior1. Execute the following code to create a DBC that contains a table with a 2. Open the dbTEST database, then open the table Test1 with the USE
3. Browse the table again, and use the mouse to delete a record. This time
Steps to Implement Workaround1. Change the CREATE TRIGGER statement to read:
2. Remove the ON ERROR WAIT WINDOW 'Delete Trigger Failed' line from the '
3. Add the following Procedure to the "Stored Procedures":
Additional reference words: 3.00 VFoxWin
KBSubcategory: FxprgBrowse
|
Last Reviewed: May 22, 1998 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |