Help with query searching within a string

B

BradC

I want to enter data character by character into a combo box and search the
field for matching records. Ex: if I type in "a" any records containing the
letter a anywhwere in the string. If I then type "h" the list will be
reduced to any records containing "ah" within the string. etc etc. I assume
this will go in the criteria box under the field I am searching. Is this
possible?
Thanks
Brad
 
J

Jeff Boyce

Brad

"within the string" is different than "starts with".

A combobox can use the AutoComplete property to help you find a row that
"starts with".

If you need to find records that "contain" (i.e., "within the string"),
consider using an unbound textbox to capture the search-for string. Also
consider not actually initiating the search until the user has entered some
minimum number of characters (3 or 4). After all, how many words in this
sentence actually contain the letter "a"?!

Good luck

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
B

BradC

Jeff Boyce said:
Brad

"within the string" is different than "starts with".

A combobox can use the AutoComplete property to help you find a row that
"starts with".

If you need to find records that "contain" (i.e., "within the string"),
consider using an unbound textbox to capture the search-for string. Also
consider not actually initiating the search until the user has entered some
minimum number of characters (3 or 4). After all, how many words in this
sentence actually contain the letter "a"?!

Good luck

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
B

BradC

Thank-you Jeff:
I am looking to do "contains within the string" and I am using a combo box.
Was trying to use the "Like" expression in the "Criteria" box but get
nowhere. My skills are obviously limited. Is this where I do this and what
do I say? My useless attempt was:
LIKE "* *"
 
J

Jeff Boyce

Brad

Again, a combobox is a "starts with" proposition. You can't use it to do
the "contains" search.

Use a text box. Then, in your query's selection criterion for the field,
use something like (untested):

Like * & Forms!YourFormName!YourTextBox & *

Note that the form will HAVE to be open and a value entered in the textbox.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

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