From: Haitham on
i am having problem in building 2 iif in one expression:
i have a file called CUR including the following 840, 422,... ect
i was building an expression when cur=840 to put it USD and cur= 422 to put
it gbp

Expr1: iif([cur]=840, "usd", [cur]=422,"lbp")

i received syntex error.
if i choose only one canges it works :

iif([cur]=840,"usd") this work with me, but when putting 2 iif it dosent work.

any suggestion?




"Huber57" wrote:

> I hope someone can help!
>
> I am running MS Access 2003. I have two Expressions built in a query that
> look like this:
>
> Expr5: IIf([ConstructionCost]>0,[ConstructionCost],"TBD")
>
> Expr2: Format([ConstructionCost],"$#,##0;-$#,##0")
>
> I want to combine the two so that the output is either: $500,000 (not
> 500000) or TBD.
>
> I can't figure out how to wrap the Format around the IIF.
>
>
>
From: John W. Vinson on
On Fri, 19 Mar 2010 12:54:07 -0700, Haitham
<Haitham(a)discussions.microsoft.com> wrote:

>i am having problem in building 2 iif in one expression:
>i have a file called CUR including the following 840, 422,... ect
>i was building an expression when cur=840 to put it USD and cur= 422 to put
>it gbp
>
>Expr1: iif([cur]=840, "usd", [cur]=422,"lbp")
>
>i received syntex error.
>if i choose only one canges it works :
>
>iif([cur]=840,"usd") this work with me, but when putting 2 iif it dosent work.
>
>any suggestion?

Read the VBA Help for IIF. It doesn't take four arguments, it takes three: an
expression which evaluates to TRUE or FALSE, a value to be returned if it's
TRUE, and a value to be returned if it's FALSE. Your third argument makes no
sense in that context!

Take a look at the VBA help for Switch(), it may be closer to what you want;
on the other hand, if you have more than two or three codes, you may want to
create a very simple little lookup table with two fields, Cur and CurText, and
join it in your query.
--

John W. Vinson [MVP]