IIF OR

A

Andy

Hi;

How do You do use the OR operator in an IIF expression?

IIF([Item]="Shirt" OR "Hat", "Sold","Not Sold")

Tried this from help:
OR
Returns TRUE if any argument is TRUE; returns FALSE if all arguments are
FALSE.
Syntax: OR(logical1,logical2, ...)

It doesn't work.

Somebody knows, would You share it?

Andy
 
G

Genius Maximus

What certainly works:

IIf (([Item]="Shirt") or ([Item]="Hat") or ([Item]="Sold") or([Item]="Not
Sold"))


Dale Fye said:
IIF([Item] = "Shirt" OR [Item] = "Hat", "Sold", "Not Sold")

HTH
Dale
Andy said:
Hi;

How do You do use the OR operator in an IIF expression?

IIF([Item]="Shirt" OR "Hat", "Sold","Not Sold")

Tried this from help:
OR
Returns TRUE if any argument is TRUE; returns FALSE if all arguments are
FALSE.
Syntax: OR(logical1,logical2, ...)

It doesn't work.

Somebody knows, would You share it?

Andy
 
V

Van T. Dinh

????

Dale's suggestion is correct.

Suggest you check Access VB Help on the syntaxt of the IIf (Immediate If)
function.
 
A

Andy

Thank You All.

Dale Your answer worked and worked correctly.

Van; I did check VB Help, MSFT KB, Access help, and 3-1,100 page reference
books before posting the question and again after reading Your reply.

Found only one example:
"OR Returns TRUE if any argument is TRUE; returns FALSE if all arguments are
FALSE.
Syntax. OR(logical1,logical2, ...). Logical1 Logical1, Logical2, ... are
1 to 30 conditions you want to test that can be either TRUE or FALSE."

And that was no help at all.

Thank You again.

Andy


Van T. Dinh said:
????

Dale's suggestion is correct.

Suggest you check Access VB Help on the syntaxt of the IIf (Immediate If)
function.

--
HTH
Van T. Dinh
MVP (Access)



Genius Maximus said:
What certainly works:

IIf (([Item]="Shirt") or ([Item]="Hat") or ([Item]="Sold") or([Item]="Not
Sold"))
 
V

Van T. Dinh

The advice to look in Help was for "Genius" with his IIf, not for you since
you already referred to Help in your original post.
 
Top