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
 
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]
 
Back
Top