Key Word Search in a memo field - How To?

C

Carl

Can anyone explain how I can create a key word search that will look in
my memo fields for a key word, or a string of characters and display
records that have a match? Any help is much appreciated!
 
M

Marshall Barton

Carl said:
Can anyone explain how I can create a key word search that will look in
my memo fields for a key word, or a string of characters and display
records that have a match? Any help is much appreciated!


Use the LIKE operator with wildcards.

In a query, set the memofield's criteria:
Like "*keyword*"

If you are trying to fo this for a control on a form:

If Me.memofield Like "*keyword*" Then
 
C

Carl

Marshall,

Thanks for the help here! Do you know how I can set up the query to be
a parameter that the user can define? I'm having trouble with syntax
here.

Thanks!

Carl
 
M

Marshall Barton

Assuming the parameter is in a query and it is coming from a
text box on a form, the criteria would be:

Like "*" & Forms!theform.txtkeyword & "*"
 
C

Carl

Marsh,

Thanks again...you truly are the Access MVP. Worked like a charm...one
last question for you. When I input your code, the query works
perfectly but I would like the text to prompt the user with "Enter
Keyword" or something like that. Right now what I get is:

Forms!theform.txtkeyword

Any suggestions?

Carl


Marshall said:
Assuming the parameter is in a query and it is coming from a
text box on a form, the criteria would be:

Like "*" & Forms!theform.txtkeyword & "*"
--
Marsh
MVP [MS Access]

Thanks for the help here! Do you know how I can set up the query to be
a parameter that the user can define? I'm having trouble with syntax
here.
 
M

Marshall Barton

It is generally better to use a form for parameters. The
prompt string kind of parameters are best use for quick and
dirty situations such as debugging.

You can get what you asked for by using:

Like "*" & [Enter Keyword] & "*"
 
C

Carl

Thanks...your input has really helped me out! I'm going to have to do
some research on how to use the forms...never had any real access
training (if you can't tell) just trying to give my disfunctional
office a leg up with tracking some basic information. If you have any
website references you would suggest I can use to learn more please
feel free to pass them along! Till then, thanks for your help!

Carl

Marshall said:
It is generally better to use a form for parameters. The
prompt string kind of parameters are best use for quick and
dirty situations such as debugging.

You can get what you asked for by using:

Like "*" & [Enter Keyword] & "*"
--
Marsh
MVP [MS Access]

Thanks again...you truly are the Access MVP. Worked like a charm...one
last question for you. When I input your code, the query works
perfectly but I would like the text to prompt the user with "Enter
Keyword" or something like that. Right now what I get is:

Forms!theform.txtkeyword
 
M

Marshall Barton

I think you would be better off getting a book or taking a
course to start. Web sites are not so good at beginner
tutorials.

Once you get the basics under your belt, I suggest that you
start with The Access Web at http://www.mvps.org/access/
You can then follow the links to other sites with still more
information and links than you can reasonanly expect to
absorn. For a specific topic, Google is your friend ;-)
--
Marsh
MVP [MS Access]

Thanks...your input has really helped me out! I'm going to have to do
some research on how to use the forms...never had any real access
training (if you can't tell) just trying to give my disfunctional
office a leg up with tracking some basic information. If you have any
website references you would suggest I can use to learn more please
feel free to pass them along! Till then, thanks for your help!


Marshall said:
It is generally better to use a form for parameters. The
prompt string kind of parameters are best use for quick and
dirty situations such as debugging.

You can get what you asked for by using:

Like "*" & [Enter Keyword] & "*"

Thanks again...you truly are the Access MVP. Worked like a charm...one
last question for you. When I input your code, the query works
perfectly but I would like the text to prompt the user with "Enter
Keyword" or something like that. Right now what I get is:

Forms!theform.txtkeyword


Marshall Barton wrote:
Assuming the parameter is in a query and it is coming from a
text box on a form, the criteria would be:

Like "*" & Forms!theform.txtkeyword & "*"


Carl wrote:
Thanks for the help here! Do you know how I can set up the query to be
a parameter that the user can define? I'm having trouble with syntax
here.


Marshall Barton wrote:
Carl wrote:

Can anyone explain how I can create a key word search that will look in
my memo fields for a key word, or a string of characters and display
records that have a match? Any help is much appreciated!


Use the LIKE operator with wildcards.

In a query, set the memofield's criteria:
Like "*keyword*"

If you are trying to fo this for a control on a form:

If Me.memofield Like "*keyword*" Then
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top