Or operator in an IIf function

E

Emile

I am trying to build an expression that is basically an IIf function, but I want to evaluate the field PCNID to see if it is either a 7 or 13 or 14 or 24

My expression looks like this:

IGFS: IIf([PCNID]=7 Or 13 Or 14 Or 24,'YES','NO')

I am not getting the required result.

Can the IIf function contain OR in the expr evaluation?

If not how would I tackle this simple issue?

Thanks in advance for any help
 
B

Brendan Reynolds

IGFS: IIf([PCNID]=7 Or [PCNID]=13 Or [PCNID]=14 Or [PCNID]=24,'YES','NO')


--
Brendan Reynolds
Access MVP


I am trying to build an expression that is basically an IIf function, but I
want to evaluate the field PCNID to see if it is either a 7 or 13 or 14 or
24

My expression looks like this:

IGFS: IIf([PCNID]=7 Or 13 Or 14 Or 24,'YES','NO')

I am not getting the required result.

Can the IIf function contain OR in the expr evaluation?

If not how would I tackle this simple issue?

Thanks in advance for any help
 
S

Steve Schapel

Emile,

The way you have done it means like this...
If (PCNID = 7) is true
or 13 is true
or 14 is true
or 24 is true

Well, 13 is always true :) whereas what you really want to test is if
(PCNID = 13) is true
.... then you have to say so:

IGFS: IIf([PCNID]=7 Or [PCNID]=13 Or [PCNID]=14 Or [PCNID]=24,'YES','NO')

An alternative approach...
IGFS: IIf([PCNID] In(7,13,14,24),'YES','NO')
 

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


Top