problem with IIF function

knightwest

Registered User.
Local time
Today, 03:21
Joined
Apr 18, 2007
Messages
16
hello again,
have written the following IIF function, which works
IIf([G/L acct]=54201,"y","")
so, if the general ledger account is equal to 54201, then put a "y" in the field, otherwise leave blank.

The problem arises because I need 2 more accounts flagged with a "y"
I have written the following SQL:
IIf([G/L acct]=54201,"y","") Or IIf([G/L acct]=54601,"y","") Or IIf([G/L acct]=54211,"y","")

This returns a "-1" in the field for all accounts, irrespective of what the account is.

How do arrange this so that only the three accounts get flagged with a "y"

Thanks for reading this.

Knightwest
 
hello again,
have written the following IIF function, which works
IIf([G/L acct]=54201,"y","")
so, if the general ledger account is equal to 54201, then put a "y" in the field, otherwise leave blank.

The problem arises because I need 2 more accounts flagged with a "y"
I have written the following SQL:
IIf([G/L acct]=54201,"y","") Or IIf([G/L acct]=54601,"y","") Or IIf([G/L acct]=54211,"y","")

This returns a "-1" in the field for all accounts, irrespective of what the account is.

How do arrange this so that only the three accounts get flagged with a "y"

Thanks for reading this.

Knightwest

Try this:
Code:
IIf([G/L acct] = 54201, "y", IIf([G/L acct] = 54601, "y", IIf([G/L acct] = 54211, "y", "")))
 
That works like a treat.

Thank you.
 
Or alternatively,

IIf([G/L acct]=54201 Or [G/L acct]=54601 Or [G/L acct]=54211,"y","")

Or simply,

IIf([G/L acct] IN (54201,54601,54211),"y","")
.
 

Users who are viewing this thread

Back
Top Bottom