iif statement in query

  • Thread starter Thread starter Joel Allen
  • Start date Start date
J

Joel Allen

Hello,

I'm trying to use an "OR" in this iif statement and it's not working. Can
somebody please help?
My goal is: if ProductResultBDHC contains C or P, then make it = 10. If
there is no C or P, then it will = 5.

LeadTime: IIf([ProductResultBDHC] Like "*C*" or IIf([ProductResultBDHC] Like
"*P*",10,5))

Thanks for your help,
Joel
 
Remove the second IIf:

IIf([ProductResultBDHC] Like "*C* or [ProductResultBDHC] Like "*P*", 10, 5)

Carl Rapson
 
Not sure - might try taking out the second IIf statement and see if it works.
 
Hello,

I'm trying to use an "OR" in this iif statement and it's not working. Can
somebody please help?
My goal is: if ProductResultBDHC contains C or P, then make it = 10. If
there is no C or P, then it will = 5.

LeadTime: IIf([ProductResultBDHC] Like "*C*" or IIf([ProductResultBDHC] Like
"*P*",10,5))

Thanks for your help,
Joel

Too many IIF's.
The letters C or P can be anywhere in the field?

LeadTime: IIf([ProductResultBDHC] Like "*C*" or [ProductResultBDHC]
Like "*P*",10,5)
 
The letters C or P can be anywhere in the field?

LeadTime: IIf([ProductResultBDHC] Like "*C*" or [ProductResultBDHC]
Like "*P*",10,5)

or:

IIF([ProductResultBDHC] Like "*[CP]*",10,5)

Putting a charlist in brackets will match any one of the characters.

John W. Vinson [MVP]
 

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