Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Invalid Syntax with multiple IIF Statement?!

Status
Not open for further replies.

djmousie

Technical User
Oct 10, 2001
164
US
I have a query with the following code:

Expr1: IIf(([A]=0,([F]-)),IIf(=0,([C]-[A]-[D]+[E])))

I can only get the query to work if i used of the IIF statements, it wont allow me to use both in the same expression, not sure why? Anyone have any thoughts?

Thanks in advance!
 
Sorry, the [ B ] made everything Bold, should be:

I have a query with the following code:

Expr1: IIf(([A]=0,([F]-[ B ])),IIf([ B ]=0,([C]-[A]-[D]+[E])))

I can only get the query to work if i used of the IIF statements, it wont allow me to use both in the same expression, not sure why? Anyone have any thoughts?

Thanks in advance!
 
Explain the goal of your IIF statement if you would. If you are attempting to have this as a nested IIF the syntax is indeed off.

Thanks,

Steve
 
I am trying to add a bunch of fields together. However, it all depends if A = ZERO or B = ZERO. IF A = ZERO I need the function to do the first expression, IF B = ZERO, I need the expression to do the second expression. The letter fields contain financial data. Does this helP?
 
I think you're missing the false part in the second IIF (I stripped out the parens & brackets to make it easier to read):

Code:
IIf(A=0,F-B, IIf(B=0,C-A-D+E, ?????))

< M!ke >
 
What if i just wanted my second expression the false, I've tried that and its not quite working:

IIf(A=0,F-B,C-A-D+E))


The above expression doesnt work either
 
Not sure; are you getting an error message or just not the results you were expecting?

The conditional IF is a quirky thing. Both expressions have to be able to be evaluated for it to work.

I did note that the example you showed has an extra parenthesis at the end...

< M!ke >
 
Actually I got it working it had to do with extra parenthesis around the arguements, thanks for your help!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top