IIf Function with "Or"

  • Thread starter Thread starter ktwtennis
  • Start date Start date
K

ktwtennis

I am trying to get a function something like this:

Proj ID: IIf(([WoProjCode]="" or "99Z9999"),"09RM003",[WoProjCode])

If the project ID is blank or "99Z9999", I want it to go to "09RM003", and
if not, then default to its own project ID.

Many thanks for any help you can provide!
 
I am trying to get a function something like this:

Proj ID: IIf(([WoProjCode]="" or "99Z9999"),"09RM003",[WoProjCode])

If the project ID is blank or "99Z9999", I want it to go to "09RM003", and
if not, then default to its own project ID.

Many thanks for any help you can provide!

The OR is a Boolean algebra operator, not an English language conjunction: it
needs to compare two true/false expressions, not two values. In addition,
unless you (unwisely usually) have WoProjCode set to Allow Zero Length
Strings, it will never be equal to ""; it will instead be NULL.

You can solve both problems with the NZ() function:

IIF(NZ([WoProjCode], "99Z9999") = "99Z9999", "09RM003", [WoProjCode])
 
Posting your question over and over doesn't encourage people to answer.

true... but it's a reasonable action when the Microsoft webpage is screwed up
(again), as it is currently; many users are seeing a bogus error message
saying that the message could not be posted when in fact it was. Don't blame
the OP, it's Microsoft's error (and yes, they're looking into it).
 

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

Similar Threads


Back
Top