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

Searching for words out of older in Access

P: n/a
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!
Reply With Quote

May 16 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
I guess you need something like this:

If Me.txtLastName > "" Then
varWhere = "[LastName] LIKE *" & Me.txtLastName & "*"
End If

Arno R

<yo***********@gmail.com> schreef in bericht news:11**********************@i39g2000cwa.googlegr oups.com...
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!
Reply With Quote

May 16 '06 #2

P: n/a
This code does not work.

May 16 '06 #3

P: n/a
* yo***********@gmail.com:
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!
Reply With Quote


You haven't provided much information so I suspect this is going to get
you some results that you don't want. But, it should get "tree".

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

If you had both boy and cowboy in the field and you search for boy,
you'd get both. This might do better.

' Check for LIKE Last Name
If Me.txtLastName > "" Then
varWhere = varWhere & "[LastName] LIKE """ & Me.txtLastName & _
" *"" OR [LastName] LIKE ""* " & Me.txtLastName & "*"""
End If
--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.
May 16 '06 #4

P: n/a
yo***********@gmail.com wrote in news:1147817129.901123.305520
@i39g2000cwa.googlegroups.com:
This code does not work.


Perhaps, you should look for some paid help. I am guessing our whole group
is sorry and embarrassed for wasting your time.

--
Lyle Fairfield
May 17 '06 #5

P: n/a
Thanks a lot Randy. Sorry for the rude reply. Didn't mean. it.

May 17 '06 #6

P: n/a
Actually, would there be a way I can search for multiple terms, out of
order.

Like, so I can search for is a case like:

cat dog bob john whatever

If I search "john bob" I would get that entry?

Thanks.

May 17 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.