multi part IIF syntax

teiben

Registered User.
Local time
Today, 17:16
Joined
Jun 20, 2002
Messages
462
I'm stuck, i have a rather long iff statement and i can get part of it to work with only two conditions: I understand the logic of it iif(test,True,False)


what i need is the iff statement to check a [statefield] for 10 possible matching states, ie.

WhatToDo: IIf([statefield]="AL" Or [statefield]="AR"Or [statefield]="AZ" "Care needed","No care needed")

if there a better way? help, using 2010
 
Could you build a table with the two fields, one for state and one for the comment then you could join it in your query on state.
 
I'm stuck, i have a rather long iff statement and i can get part of it to work with only two conditions: I understand the logic of it iif(test,True,False)


what i need is the iff statement to check a [statefield] for 10 possible matching states, ie.

WhatToDo: IIf([statefield]="AL" Or [statefield]="AR"Or [statefield]="AZ" "Care needed","No care needed")

if there a better way? help, using 2010

If I understand your needs correctly, this might be a good place to use an IN statement.

IIf([statefield] IN ("AL", "AR", "AZ"), "Care needed", "No care needed")

The example shows three items, but you can add as many additional items as you need (you said that you would need 10).
 

Users who are viewing this thread

Back
Top Bottom