Like Function

Z

zyus

I try to group these records in my eqpdesc field using if & like functions in
query

eqpdesc
toyota camry
unser toyota
crv honda
honda accord
proton

I used this function in my query
IIf([eqpdesc] Like "*toyota*" or "*honda*","Imported Car","Local Car")
but cannot get the expected result.

I expect to group all other car than proton as Imported Car
 
J

John W. Vinson

I try to group these records in my eqpdesc field using if & like functions in
query

eqpdesc
toyota camry
unser toyota
crv honda
honda accord
proton

I used this function in my query
IIf([eqpdesc] Like "*toyota*" or "*honda*","Imported Car","Local Car")
but cannot get the expected result.

I expect to group all other car than proton as Imported Car

The OR operator doesn't separate criteria - it separates logical expressions,
which are individually either TRUE or FALSE. The string "*honda*" is not such
an expression, but since it is not equal to 0, Access will treat it as if it
were true!

Try

IIf(InStr([eqpdesc], "toyota") > 0 OR InStr([eqpdesc], "honda") > 0, "Imported
car", "Local car")
 

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