Connecting Tech Pros Worldwide Forums | Help | Site Map

Searching for words out of older in Access

yourtrashhere@gmail.com
Guest
 
Posts: n/a
#1: May 16 '06
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


Arno R
Guest
 
Posts: n/a
#2: May 16 '06

re: Searching for words out of older in Access


I guess you need something like this:

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

Arno R

<yourtrashhere@gmail.com> schreef in bericht news:1147755409.221957.208400@i39g2000cwa.googlegr oups.com...[color=blue]
> 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
>[/color]
yourtrashhere@gmail.com
Guest
 
Posts: n/a
#3: May 16 '06

re: Searching for words out of older in Access


This code does not work.

Randy Harris
Guest
 
Posts: n/a
#4: May 16 '06

re: Searching for words out of older in Access


* yourtrashhere@gmail.com:[color=blue]
> 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
>[/color]

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.
Lyle Fairfield
Guest
 
Posts: n/a
#5: May 17 '06

re: Searching for words out of older in Access


yourtrashhere@gmail.com wrote in news:1147817129.901123.305520
@i39g2000cwa.googlegroups.com:
[color=blue]
> This code does not work.[/color]

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

--
Lyle Fairfield
yourtrashhere@gmail.com
Guest
 
Posts: n/a
#6: May 17 '06

re: Searching for words out of older in Access


Thanks a lot Randy. Sorry for the rude reply. Didn't mean. it.

yourtrashhere@gmail.com
Guest
 
Posts: n/a
#7: May 17 '06

re: Searching for words out of older in Access


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.

Closed Thread