In my form footer, I have three four controls
- Gross Amount (Named: "TxtGrossAmount")
- GDiscount (Gross Discount in value e.g $30)
- TDiscount (Discount in percentage form. E.g. 4%)
- Net Payable (Named "TxtNetPayable")
On the control of "NetPayable" I have attached the following IIF function:
=IIf([GDiscount] And [TDiscount] Is Not Null,([TxtGrossAmount]-[GDiscount])*(1-[TDiscount]),IIf([GDiscount] Is Null,[TxtGrossAmount]*(1-[TDiscount]),IIf([TDiscount] Is Null,[TxtGrossAmount]-[GDiscount],[TxtGrossAmount])))
- The function should test if the controls "GDiscount" and "TDiscount" have a value in them, If yes, it subtracts GrossDiscount from GrossAmount and to the difference, it applies the rate in the control "TDiscount" then returns the final answer. (This works good)
- Secondly, it test if GDiscount is Null, and If yes, it applies the rate in "TDiscount" and returns the difference. (This works well too)
- Thirdly, it verifies if "TDiscount" is Null, and If yes, It looks for the difference between "GrossAmount" and "GDiscount" and returns that difference. (this works well)
- Finally, in the absence of TDiscount and GDiscount, it should return the Gross Amount. (This is were the problem lies)
I dont know why the last condition is not respected.