txt box as inut to query criteria

P

papa jonah

I have created a form with a text box (txtInput). My hope is to be
able to enter a string to be used as criteria in a query. For example,
I want to be able to enter *elect* into the text box and have the query
result in anything that has "electrical" or "electric" in it. The way
that I have built the query inlcudes the following for the criteria.
[Forms]![query form]![txtInput]
It doesn't work. If I substitute the above criteria with "*electr*" -
it works fine.

This is modeled after a similar structure that uses a combobox instead
of a text box which also works.

Any ideas?
 
F

fredg

I have created a form with a text box (txtInput). My hope is to be
able to enter a string to be used as criteria in a query. For example,
I want to be able to enter *elect* into the text box and have the query
result in anything that has "electrical" or "electric" in it. The way
that I have built the query inlcudes the following for the criteria.
[Forms]![query form]![txtInput]
It doesn't work. If I substitute the above criteria with "*electr*" -
it works fine.

This is modeled after a similar structure that uses a combobox instead
of a text box which also works.

Any ideas?

Is the criteria Field's datatype Text?
Change the query criteria to:
Like "*" & [Forms]![query form]![txtInput] & "*"

Then just enter elect (not *elect*) in the text control.

The form must be open when the query is run.
 

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