Search memo field using criteria from a Form

B

b dubbin

How do I search a memo field as a partial string as defined by a user entered
on a form using a query?

What I mean...

- I have a form (frmReport).
- frmReport has a textbox (txtDescription)
- A user can enter a string of words into the textbox.

- I have a query (qryDescription)
- qryDescription has a field (fdDescription) from a table (tblDescription).
- fdDescription field has a Data Type of 'Memo'.

- I want to place criteria on the qryDescription query based on whatever the
user enters in the textbox txtDescription on the frmReport form.

Within the query builder as 'Criteria' for fdDescription I tried:

Like "*[Forms]![frmReport]![txtDescription]*"

The query runs but no values are returned when a word(s) is inputted on the
frmReport that contains a word in the tblDescription.

I also tried:

Like "*" & [Forms]![frmReport]![txtDescription] & "*"

The query runs but returns all records.

What should I type in the Criteria box of the query (or what's the SQL) that
I need to use?

Thanks in advance...
 
K

KARL DEWEY

The criteria below should work for you.
Like "*" & [Forms]![frmReport]![txtDescription] & "*"

Try entering something in the form and then go to the query and run it.

Try running the query with out the form - use Like "*" & [Enter word] & "*".
 
B

b dubbin

Thanks for your reply, Karl.

Unfortunately
Like "*" & [Forms]![frmReport]![txtDescription] & "*"

Returns all rows irregardless of whether or not I put anything in the form.

As for using
Like "*" & [Enter word] & "*"

Yes, that restricts the returned values based on what I enter in the query
but ideally I want the user to use the description field in the form instead
of a prompt box. Any more ideas?

I appreciate the help!
 
B

b dubbin

One reason I want to capture the description on the form is that I want to
pass that value to a report.

Is there a way to capture the value entered in a prompt box to display on a
report associated with that query?

Thanks all.
 
K

KARL DEWEY

Yes - to capture the value entered in a prompt box to display on a report
just use the query for the report record source.

b dubbin said:
One reason I want to capture the description on the form is that I want to
pass that value to a report.

Is there a way to capture the value entered in a prompt box to display on a
report associated with that query?

Thanks all.

b dubbin said:
Thanks for your reply, Karl.

Unfortunately
Like "*" & [Forms]![frmReport]![txtDescription] & "*"

Returns all rows irregardless of whether or not I put anything in the form.

As for using
Like "*" & [Enter word] & "*"

Yes, that restricts the returned values based on what I enter in the query
but ideally I want the user to use the description field in the form instead
of a prompt box. Any more ideas?

I appreciate the help!
 
B

b dubbin

Thanks Karl... I've set the record source to be the query... now how do I
make the text box on the report pull the prompt value? The only values in
the control source for the text box are the fields from the query. I'm
using the prompt box as a key word search for a memo field so I want to be
able to display on the report the value the user entered in the prompt box.

Thanks again.



KARL DEWEY said:
Yes - to capture the value entered in a prompt box to display on a report
just use the query for the report record source.

b dubbin said:
One reason I want to capture the description on the form is that I want to
pass that value to a report.

Is there a way to capture the value entered in a prompt box to display on a
report associated with that query?

Thanks all.

b dubbin said:
Thanks for your reply, Karl.

Unfortunately
Like "*" & [Forms]![frmReport]![txtDescription] & "*"

Returns all rows irregardless of whether or not I put anything in the form.

As for using
Like "*" & [Enter word] & "*"

Yes, that restricts the returned values based on what I enter in the query
but ideally I want the user to use the description field in the form instead
of a prompt box. Any more ideas?

I appreciate the help!
 
K

KARL DEWEY

When the query is run it will prompt.

Add a field to your query like --
X: [YourPrompt]
Copy the information from the criteria row of the query as you want them
both to be indentical. This way the query will output what was entered in
the prompt.

b dubbin said:
Thanks Karl... I've set the record source to be the query... now how do I
make the text box on the report pull the prompt value? The only values in
the control source for the text box are the fields from the query. I'm
using the prompt box as a key word search for a memo field so I want to be
able to display on the report the value the user entered in the prompt box.

Thanks again.



KARL DEWEY said:
Yes - to capture the value entered in a prompt box to display on a report
just use the query for the report record source.

b dubbin said:
One reason I want to capture the description on the form is that I want to
pass that value to a report.

Is there a way to capture the value entered in a prompt box to display on a
report associated with that query?

Thanks all.

:

Thanks for your reply, Karl.

Unfortunately
Like "*" & [Forms]![frmReport]![txtDescription] & "*"

Returns all rows irregardless of whether or not I put anything in the form.

As for using
Like "*" & [Enter word] & "*"

Yes, that restricts the returned values based on what I enter in the query
but ideally I want the user to use the description field in the form instead
of a prompt box. Any more ideas?

I appreciate the help!
 

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