help with iif access

  • Thread starter Thread starter hailadeel
  • Start date Start date
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?
 
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]
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top