By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,479 Members | 988 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,479 IT Pros & Developers. It's quick & easy.

Like for Multiple Word Searches

P: n/a
I've been searching for days, using MS help and I can't find the answer
on my own.

I have this code in my Access Form:

If Not IsNull(Me.txtFilterDescriptionMatName) Then
txtFilterDescriptionMatName =
Replace(txtFilterDescriptionMatName, Chr$(34), Chr$(34) & Chr$(34))
StrWhere = StrWhere & "([DescriptionMatName] LIKE ""*" &
Me.txtFilterDescriptionMatName & "*"" ) AND "
It works well and pulls up all the rows based on a "one word" search,
but if I use 2 or more words I get zero results. Is there any way to
have the cabability to have my people search for more then 1 word and
get the results: IE: Search for Orange Shoes (and the description
DescriptionMatName field has "Orange Leather Tossle Shoes" show up in
the results.
Right now if I search for Orange or Shoes this result would come up.

Thank you.

TraceyDee

Oct 13 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
td********@qosina.com wrote:
I've been searching for days, using MS help and I can't find the answer
on my own.

I have this code in my Access Form:

If Not IsNull(Me.txtFilterDescriptionMatName) Then
txtFilterDescriptionMatName =
Replace(txtFilterDescriptionMatName, Chr$(34), Chr$(34) & Chr$(34))
StrWhere = StrWhere & "([DescriptionMatName] LIKE ""*" &
Me.txtFilterDescriptionMatName & "*"" ) AND "
It works well and pulls up all the rows based on a "one word" search,
but if I use 2 or more words I get zero results. Is there any way to
have the cabability to have my people search for more then 1 word and
get the results: IE: Search for Orange Shoes (and the description
DescriptionMatName field has "Orange Leather Tossle Shoes" show up in
the results.
Right now if I search for Orange or Shoes this result would come up.

Thank you.

TraceyDee
If you have "Like *Apples* And Like "*Oranges* then your probleem is the
word AND. You only want a hit on 1 of the multiple words...not each and
every word...so you use the word OR. "Like *Apples* Or Like "*Oranges*
Oct 13 '06 #2

P: n/a
I replaced the AND with OR and I get an error. I assume that you were
referring to replacing the AND in the code so searching for more then 1
word, I would get results?
salad wrote:
td********@qosina.com wrote:
I've been searching for days, using MS help and I can't find the answer
on my own.

I have this code in my Access Form:

If Not IsNull(Me.txtFilterDescriptionMatName) Then
txtFilterDescriptionMatName =
Replace(txtFilterDescriptionMatName, Chr$(34), Chr$(34) & Chr$(34))
StrWhere = StrWhere & "([DescriptionMatName] LIKE ""*" &
Me.txtFilterDescriptionMatName & "*"" ) AND "
It works well and pulls up all the rows based on a "one word" search,
but if I use 2 or more words I get zero results. Is there any way to
have the cabability to have my people search for more then 1 word and
get the results: IE: Search for Orange Shoes (and the description
DescriptionMatName field has "Orange Leather Tossle Shoes" show up in
the results.
Right now if I search for Orange or Shoes this result would come up.

Thank you.

TraceyDee
If you have "Like *Apples* And Like "*Oranges* then your probleem is the
word AND. You only want a hit on 1 of the multiple words...not each and
every word...so you use the word OR. "Like *Apples* Or Like "*Oranges*
Oct 13 '06 #3

P: n/a
td********@qosina.com wrote:
I replaced the AND with OR and I get an error. I assume that you were
referring to replacing the AND in the code so searching for more then 1
word, I would get results?
salad wrote:
>>td********@qosina.com wrote:

>>>I've been searching for days, using MS help and I can't find the answer
on my own.

I have this code in my Access Form:

If Not IsNull(Me.txtFilterDescriptionMatName) Then
txtFilterDescriptionMatName =
Replace(txtFilterDescriptionMatName, Chr$(34), Chr$(34) & Chr$(34))
StrWhere = StrWhere & "([DescriptionMatName] LIKE ""*" &
Me.txtFilterDescriptionMatName & "*"" ) AND "
It works well and pulls up all the rows based on a "one word" search,
but if I use 2 or more words I get zero results. Is there any way to
have the cabability to have my people search for more then 1 word and
get the results: IE: Search for Orange Shoes (and the description
DescriptionMatName field has "Orange Leather Tossle Shoes" show up in
the results.
Right now if I search for Orange or Shoes this result would come up.

Thank you.

TraceyDee

If you have "Like *Apples* And Like "*Oranges* then your probleem is the
word AND. You only want a hit on 1 of the multiple words...not each and
every word...so you use the word OR. "Like *Apples* Or Like "*Oranges*

Yes. And you'd reference with the field to search. With my example, I
simple used apples and oranges, no field mentioned, and didn't use
quotes. You have to create a string that makes sense.

ALso, enter
Debug.Print strWhere
and go into the Debug window and see what values you have for strWhere.
You could create a query and then do a ViewSQL and paste the strWhere
value into the query. That will let you see what's wrong.
Oct 13 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.