From: Cam on
Hello,

I have the following field in the query to look at a field PartDesc, if any
of the text have a *BUSH* word, return yes, otherwise no.
BUSH: IIF(PartDesc= Like *BUSH*, "yes","no")

Why the Like *BUSH* not working? Thanks
From: vanderghast on
Because = and LIKE are two operators, a little bit like:

4 * / 3

would mean what (multiply followed by divide)?

Probably better to remove the =, in this case:

BUSH: IIF(PartDesc Like *BUSH*, "yes","no")


Vanderghast, Access MVP


"Cam" <Cam(a)discussions.microsoft.com> wrote in message
news:06C17F00-71D3-4C38-9AFE-5D721AF338CC(a)microsoft.com...
> Hello,
>
> I have the following field in the query to look at a field PartDesc, if
> any
> of the text have a *BUSH* word, return yes, otherwise no.
> BUSH: IIF(PartDesc= Like *BUSH*, "yes","no")
>
> Why the Like *BUSH* not working? Thanks

From: rbeach on
Try using the below:

BUSH: IIf([PartDesc] ALike "%BUSCH%","yes","no")

--
Rick


"Cam" wrote:

> Hello,
>
> I have the following field in the query to look at a field PartDesc, if any
> of the text have a *BUSH* word, return yes, otherwise no.
> BUSH: IIF(PartDesc= Like *BUSH*, "yes","no")
>
> Why the Like *BUSH* not working? Thanks
From: fredg on
On Thu, 13 May 2010 07:00:01 -0700, Cam wrote:

> Hello,
>
> I have the following field in the query to look at a field PartDesc, if any
> of the text have a *BUSH* word, return yes, otherwise no.
> BUSH: IIF(PartDesc= Like *BUSH*, "yes","no")
>
> Why the Like *BUSH* not working? Thanks

You cannot use = Like. Use either = or Like.
You also need to enclose the criteria value within quotes.

BUSH: IIF(PartDesc Like "*BUSH*", "yes","no")

The above should fine all records that contain the letters "BUSH"
anywhere in the field, i.e. "Bush", "Bushmill", etc.

if you wish just the word "Bush" to be returned, use Like "* Bush *"

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
 | 
Pages: 1
Prev: Query from day of week
Next: REMOVING LEADING ZERO