>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?
Frank,
Aside from the other answers you may get the "Illegal recursion in rule evaluation" if there's an error in your code like referencing a variable that does not exist (or a field of an alias that is not the current one) or even an operator/operand mismatch (like a='123' followed by b = a+1)
Best you can do is to put an 'Assert FALSE' at the start of your code and debug it step by step. If you find the line that is causing the error, you will know
Gregory