help with iif access

H

hailadeel

Hi, i have two text boxes with iif statements, basically both are (iif
[cost] <> 0, [cost], " ") then on the difference column where I compare
the two costs i tried inserting a condition that iif
((([cost1]<>0,(iif([cost2]<>0,[cost1]-[cost2]," ")" ")..however i
continue to get errors...any suggestions?
 
J

John Vinson

Hi, i have two text boxes with iif statements, basically both are (iif
[cost] <> 0, [cost], " ") then on the difference column where I compare
the two costs i tried inserting a condition that iif
((([cost1]<>0,(iif([cost2]<>0,[cost1]-[cost2]," ")" ")..however i
continue to get errors...any suggestions?

The correct syntax would be

IIF([Cost] <> 0, [Cost], Null)

For the difference, do you want to display a blank if EITHER cost
value is zero, and only do the subtraction if both are nonzero? If so,

IIf([Cost1] <> 0 AND [Cost2] <> 0, [Cost1]-[Cost2], NULL)

should work (in one IIF without nesting). You're apparently getting an
error because of a missing comma and mismatched parentheses.

John W. Vinson[MVP]
 
H

hailadeel

John said:
Hi, i have two text boxes with iif statements, basically both are (iif
[cost] <> 0, [cost], " ") then on the difference column where I compare
the two costs i tried inserting a condition that iif
((([cost1]<>0,(iif([cost2]<>0,[cost1]-[cost2]," ")" ")..however i
continue to get errors...any suggestions?

The correct syntax would be

IIF([Cost] <> 0, [Cost], Null)

For the difference, do you want to display a blank if EITHER cost
value is zero, and only do the subtraction if both are nonzero? If so,

IIf([Cost1] <> 0 AND [Cost2] <> 0, [Cost1]-[Cost2], NULL)

should work (in one IIF without nesting). You're apparently getting an
error because of a missing comma and mismatched parentheses.

John W. Vinson[MVP]

perfect thank you very much
David
 
Top