iif statement for calculations...

C

clueless

I would like to display totals from 2 different formulas in query. If
condition a= xxx *3.20, if condition b=xxx *0.59. I don't have a clue on how
to use the iif statement. Thanks for your help.
 
J

Jeff Boyce

I can't tell from your description what needs to be multiplied, and what
conditions are being tested, and ...

Try using Access HELP for IIF() -- the proper syntax should be shown there.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
J

John W. Vinson

I would like to display totals from 2 different formulas in query. If
condition a= xxx *3.20, if condition b=xxx *0.59. I don't have a clue on how
to use the iif statement. Thanks for your help.

Since you don't say what conditions A and B are; whether they are mutually
exclusive (could both be true??); whether there is or might be a condition C;
etc., it's rather hard to guess what might be a useful answer.


John W. Vinson [MVP]
 
C

clueless

Sorry, conditions are acct names if acct a =hardback *3.20, b=paperback *0.59
and place in total .
 
J

John W. Vinson

Sorry, conditions are acct names if acct a =hardback *3.20, b=paperback *0.59
and place in total .

Are those the ONLY values? You'll never have EBooks or papeback (typos)?

If so then there are only two choices: hardback and everything else. In that
case

XXX * IIf([acct] = "Hardback", 3.20, 0.59)

If you want to allow for other choices, use the Switch() function instead. It
takes arguments in pairs, and evaluates them left to right; it returns the
second member of the first pair for which the first argument is true:

XXX * Switch([Acct] = "Hardback", 3.20, [Acct] = "Paperback", 0.59, True,
NULL)

will return the specified results and NULL for all other Acct values.

John W. Vinson [MVP]
 
Top