PRB: Trigger Fails with One-to-Many Form Wizard and RI BuilderLast reviewed: September 29, 1995Article ID: Q137278 |
The information in this article applies to:
SYMPTOMSThe following sequence of events results in this error:
Failed to update table: Trigger Failed Sequence of Events Leading to Error
CAUSEWhen Visual FoxPro opens the tables, it opens the parent first and then the child. The Parent table is opened in work area one. When the child table is opened, the parent is moved to work area two, and the child is opened in work area one. The UpdateRows method in Wizstyle.vcx handles updating the tables. It uses the AUSED() function to place the names of the tables into an array and a For loop to cycle through each table and append the new record. Because the record is appended to the child table first (because of its order in the array and work area), the trigger cannot find a matching record in the parent, so it fails. If the the record was appended to the parent table first, the problem would not occur.
RESOLUTIONYou can modify the code in the UpdateRows method of the txtbtns class of Wizstyle.vcx. Find the line that reads:
FOR I = 1 TO m.nTablesUsedChange it to this:
FOR I = m.nTablesUsed TO 1 STEP -1This causes the record to be appended to the parent table first, so the Insert trigger will see a corresponding record in the parent when it updates the child.
STATUSThis behavior is by design.
MORE INFORMATION
Steps to Reproduce Behavior
|
Additional reference words: 3.00 VFoxWin
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |