Like Function

  • Thread starter Thread starter zyus
  • Start date Start date
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
 
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")
 
Back
Top