What's wrong with this IIf expression

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want the expression to show "BI" from all values start from BI**** BUt it
doesnt work. I am using * as wildcare:

IIf([Subject]=BI*, "BI") and this too: IIf([Subject]=*F1*, "F1")

Is BI* valid value? (in Subject field I have BIF1A, BIF3B & etc)

What is worng ?
Pls help. Thank you
 
IIf(expr, truepart, falsepart)

You need to put in a falsepart if it isn't BI*. Then there is the problem of
the wildcard. Try this instead.

IIf(Left([Subject],2)= "BI", "BI", [Subject])
 
betan said:
I want the expression to show "BI" from all values start from BI**** BUt it
doesnt work. I am using * as wildcare:

IIf([Subject]=BI*, "BI") and this too: IIf([Subject]=*F1*, "F1")

Is BI* valid value? (in Subject field I have BIF1A, BIF3B & etc)


You must use the Like operator with wildcards. Also, the
pattern must be enclosed in quotes:

IIf([Subject] Like "BI*", "BI")
 
Thanks Jerry for the help

Jerry Whittle said:
IIf(expr, truepart, falsepart)

You need to put in a falsepart if it isn't BI*. Then there is the problem of
the wildcard. Try this instead.

IIf(Left([Subject],2)= "BI", "BI", [Subject])
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

betan said:
I want the expression to show "BI" from all values start from BI**** BUt it
doesnt work. I am using * as wildcare:

IIf([Subject]=BI*, "BI") and this too: IIf([Subject]=*F1*, "F1")

Is BI* valid value? (in Subject field I have BIF1A, BIF3B & etc)

What is worng ?
Pls help. Thank you
 
Thanks Barton for the help

Marshall Barton said:
betan said:
I want the expression to show "BI" from all values start from BI**** BUt it
doesnt work. I am using * as wildcare:

IIf([Subject]=BI*, "BI") and this too: IIf([Subject]=*F1*, "F1")

Is BI* valid value? (in Subject field I have BIF1A, BIF3B & etc)


You must use the Like operator with wildcards. Also, the
pattern must be enclosed in quotes:

IIf([Subject] Like "BI*", "BI")
 

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

Back
Top