I have the following data string in the tct box [txtPerGain];
=IIf([Closed]=-1,[Loss/Gain]/[StkSub Queryfrm].[Form]![txt Bought_Cst],IIf([txt Cost Basis]=0,0,[Loss/Gain]/([txt Cost Basis]-[Div])))
The statement evaluates perfectly unless [txt Cost Basis] is less then [Div]. Of course, it will give me a negative number. I changed the data string to:
=IIf([Closed]=-1,[Loss/Gain]/[StkSub Queryfrm].[Form]![txt Bought_Cst],IIf([txt Cost Basis]=0,0,IIf([txt Cost Basis]>[Div],[Loss/Gain]/([txt Cost Basis]-[Div], Loss/Gain]/([txt Cost Basis]+[Div))))
I added the 3rd IIf statement to evaluate when [Div] is greater than [txt Cost Basis]. However, access will not accept it. CVlaims I have too many commas or strings without quotation Marks. I have fooled with it for awhile and decided that one of you could probably look at it and spot the error immediately!
Thanks for your help, Bill
=IIf([Closed]=-1,[Loss/Gain]/[StkSub Queryfrm].[Form]![txt Bought_Cst],IIf([txt Cost Basis]=0,0,[Loss/Gain]/([txt Cost Basis]-[Div])))
The statement evaluates perfectly unless [txt Cost Basis] is less then [Div]. Of course, it will give me a negative number. I changed the data string to:
=IIf([Closed]=-1,[Loss/Gain]/[StkSub Queryfrm].[Form]![txt Bought_Cst],IIf([txt Cost Basis]=0,0,IIf([txt Cost Basis]>[Div],[Loss/Gain]/([txt Cost Basis]-[Div], Loss/Gain]/([txt Cost Basis]+[Div))))
I added the 3rd IIf statement to evaluate when [Div] is greater than [txt Cost Basis]. However, access will not accept it. CVlaims I have too many commas or strings without quotation Marks. I have fooled with it for awhile and decided that one of you could probably look at it and spot the error immediately!
Thanks for your help, Bill