A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

IIF function help in query



 
 
Thread Tools Display Modes
  #1  
Old May 13th, 2010, 03:00 PM posted to microsoft.public.access.queries
Cam
external usenet poster
 
Posts: 253
Default IIF function help in query

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
  #2  
Old May 13th, 2010, 03:11 PM posted to microsoft.public.access.queries
vanderghast
external usenet poster
 
Posts: 593
Default IIF function help in query

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" wrote in message
...
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


  #3  
Old May 13th, 2010, 03:15 PM posted to microsoft.public.access.queries
rbeach
external usenet poster
 
Posts: 48
Default IIF function help in query

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

  #4  
Old May 13th, 2010, 07:28 PM posted to microsoft.public.access.queries
fredg
external usenet poster
 
Posts: 4,386
Default IIF function help in query

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
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:53 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.