IIF statement problem

G

Guest

I want to return text if two of five possible values are in a field. Here is an example of what I have been trying to use:

From Fund Type: IIf([From Fund] Like "*4*" Or Like "*5*","Facilities","Resources")

This expression returns only the not true value of "Resources". I have tried "and" as an operator with the same erroneous value. I I use only one like value, the true value of "Facilities returns. I tried joining two expressions with ; iif.... and got 0 for the true value and -1 for the not true value...any other joins of the expression I have tried have resulted in some type of error message.

Any suggestions? ***thanks***
 
M

Michel Walsh

Hi,

iif( (FieldName Like "*4*" ) AND ( FieldName Like "*5*" ), " both 4
and 5 ", "either one of 4, or 5 is (are) absent")

would return "both 4 and 5" if FieldName value is "x5y4z", as example.




Hoping it may help,
Vanderghast, Access MVP


susm said:
I want to return text if two of five possible values are in a field. Here
is an example of what I have been trying to use:
From Fund Type: IIf([From Fund] Like "*4*" Or Like "*5*","Facilities","Resources")

This expression returns only the not true value of "Resources". I have
tried "and" as an operator with the same erroneous value. I I use only one
like value, the true value of "Facilities returns. I tried joining two
expressions with ; iif.... and got 0 for the true value and -1 for the not
true value...any other joins of the expression I have tried have resulted in
some type of error message.
 
G

Guest

this worked! thank you..

----- Jim Richards wrote: ----

Try this: From Fund Type: IIf([From Fund] Like "*4*" Or [From Fund] Like "*5*","Facilities","Resources"

Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top