Searching terms out of order

  • Thread starter Thread starter yourtrashhere
  • Start date Start date
Y

yourtrashhere

So basically, what I have is a bunch of words in one memo field, for
example:

dog cat cowboy tree flower

To search it, this is the code I have now.

' Check for LIKE Last Name
If Me.txtLastName > "" Then
varWhere = varWhere & "[LastName] LIKE """ & Me.txtLastName & "*" * "
AND "
End If

The only problem is what I search for needs to be "in order", for
example, if I search for dog, I'll get the table. But, if I seach for
tree, I won't because tree was not place first. Can you please help me?
Thanks a lot!
 
You need an asterisk before and after your text.

Instead of looking for...
Like "dog" & *

you need

Like * & "dog" & *
 
Could you tell me how to implement it. I just want to search out
of order. So here's what my table looks like:

|NAME|TAGS |
|Bob |dog cat flower water|

With the code I have, I can only search for the record by using "dog".
I want to search for the record by using either "water" or "flower" or
"cat". Could you please show me the code implementation(I don't know
much about access, if you could change that code, that would be great).
Thanks for your reply!
 
Looking for Dog* will find anything starting with dog.

Looking for *Dog will find anything ending with dog.

Looking for *Dog* will find "dog" anywhere in the string.

Just include an asterisk before and after your search. I am not sure
exactly how to rewrite it. I would think your code would be something like
the following, but I have not tested that. You know your code better than I
do, so you should be able to modify it to include an extra asterisk....


[LastName] LIKE * & Me.txtLastName & *
 
So basically, what I have is a bunch of words in one memo field, for
example:

dog cat cowboy tree flower

Answered in microsoft.public.access (with some difficulty, since
you're not putting your actual question - how to do this with variable
keywords - into your question).

Please don't multipost. It wastes the volunteers' time answering
questions which have already been answered. If you wish to post in
multiple groups (hint: usually not necessary), crosspost instead. See
http://www.mvps.org/access/netiquette.htm for some posting hints.

John W. Vinson[MVP]
 
Back
Top