IIF / OR condition (can OR be used)?

  • Thread starter kev100 via AccessMonster.com
  • Start date
K

kev100 via AccessMonster.com

I'm needing a text box to display the value of Field 1...IF the value of the
field is either "BLUE" or GREEN"

If the value of Field 1 is NOT either of these.....it needs to display the
value of Field2.

I've tried:

=IIf([Field1]="BLUE" Or "GREEN",[Field1],[Field2]) --- this will simply
mirror Field1...no matter what its value.

=IIf([Field1]=("BLUE" Or "GREEN"),[Field1],[Field2]) --- this will error out

=IIf([Field1]="BLUE",[Field1],[Field2]) ---- tried this as a test...it works
fine....but only considers the "BLUE" condidtion.

Something about putting in an OR complicates things.....can OR be used at all?


Thanks very much.
 
G

Guest

It is only a syntax problem. When you are doing comparisons, you have to
specify the field or variable for each.

=IIf([Field1]="BLUE" Or [Field1]="GREEN",[Field1],[Field2])
Or
=IIf([Field1] IN("BLUE", "GREEN"),[Field1],[Field2])
 
K

kev100 via AccessMonster.com

Thanks....go it.....

=IIf([Field1] IN("BLUE", "GREEN"),[Field1],[Field2])

....did the trick.

Thanks Very much.
 

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

Top