Hi Hilmar,
can you explain why you think the trigger is updating its own table? The trigger i have is on SalesDetails.dbf and it is updating the Items table. But when it tries to update the items table, the field rule on the items table fails.
Thanks.
>It seems that in a trigger on a specific table, you can't update that same table. If you need to do adjustments, you might transfer that to code on the manipulating form, for instance.
>
>>HI,
>>
>>I've got a field rule on Items.iQtyOnHand:
>>
>>iqtyonhand=>0
>>
>>
>>I've also got a trigger on SalesDetails:
>>
>>vmp_ri("INSERT").AND.adjustqtyonhand(iitemid,iqty*-1)
>>
>>
>>My trigger procedure is:
>>
>>PROCEDURE AdjustQtyOnHand
>>LPARAMETERS tiItemId, tiQty
>>
>>UPDATE Items;
>> SET iQtyOnHand = iQtyOnHand + m.tiQty ;
>> WHERE iItemId = m.tiItemId ;
>> AND cType # "Service"
>>
>>
>>If I enter a sale of an item that results in a negative stock value, when running the exe in runtime, I get an error: "Illegal recursion in rule evaluation" (after I get my "Not enough stock available" MsgSvc message).
>>
>>The error is #1887 and the help suggests checking my rule and trigger code.
>>
>>Can anybody see what's wrong?