Search a Memo (1 Viewer)

wizcow

Registered User.
Local time
Yesterday, 18:28
Joined
Sep 22, 2001
Messages
236
I have a large memo box that I would like to search.

The memobox will have data similar to this...

Bill
Doug and Fred
Ted
I want to be able to hit the return key and enter another line in the memobox.

When I do a search on this field, the top value can be found, but not the values after the 'enter'.
eg: Above I could find Bill, but not Ted

How do I get the search to recognize more than the first line?

Thanks
Tom
 

wizcow

Registered User.
Local time
Yesterday, 18:28
Joined
Sep 22, 2001
Messages
236
Ah yes, I'm being a bit vague.

I have a search form with a text box for search criteria.
When the search is started, a subform shows the filtered data.
The subforms record source is changed with an SQL statement in code.

Dim strSQLSF As String

strSQLSF = "SELECT * FROM tblTapeSub "
strSQLSF = strSQLSF & " WHERE tblTapeSub.Memobox = Forms!tape![txtSearch]"

Forms!tape!TapeSub.Form.RecordSource = strSQLSF
Forms!tape!TapeSub.Form.Requery

This only searches the first line of the memobox.

How can I get the search to see all lines in the memobox.

Thanks
Tom
 

WayneRyan

AWF VIP
Local time
Today, 01:28
Joined
Nov 19, 2002
Messages
7,122
Tom,

WHERE tblTapeSub.Memobox Like "*" & Forms!tape![txtSearch] & "*"

It's hard to match a whole memo field.

Wayne
 

wizcow

Registered User.
Local time
Yesterday, 18:28
Joined
Sep 22, 2001
Messages
236
Thanks for the reply, guys.

I am still having a problem with the syntax I think, as I get an error when I run this line of code. I tried a few things and nothing works yet.

strSQLSF = strSQLSF & " WHERE tblTapeSub.memobox Like " * " & Forms!tape![txtSearch] & " * ""

strSQLSF = strSQLSF & " WHERE tblTapeSub.memobox Like '" * "' & Forms!tape![txtSearch] & '" * "'"
\

strSQLSF = strSQLSF & " WHERE tblTapeSub.memobox Like ' * ' & Forms!tape![txtSearch] & ' * '"

I think its the quotes are giving me trouble.
Do you see what is going awry?
My SQL is limited.

Thanks
Tom
 

soundsfishy

Registered User.
Local time
Today, 10:28
Joined
Sep 25, 2002
Messages
174
this may be of some use to you
 

Attachments

  • findtext inmemodemo.zip
    33.3 KB · Views: 126

wizcow

Registered User.
Local time
Yesterday, 18:28
Joined
Sep 22, 2001
Messages
236
soundsfishy

Wow! This is a great example, I hope lots of people download it.

Thanks
Tom
 

Users who are viewing this thread

Top Bottom