Combo box boolean search

M

MikeO

Is there a way to search a combo box for any word in the field?
Example: "MASK, N95, LARGE" would show up in the list by tying any of the
three words. Find "large" masks by typing "LARGE" and "mask, N95, large would
be in the list as well as anything else that has "large" in the description.

Thanks,
Mike O
 
J

John W. Vinson

Is there a way to search a combo box for any word in the field?

No, but you can search the table upon which the combo box is based. Data is
not stored in combo boxes (or forms, or textboxes, or listboxes) - it's stored
in tables, and only tables can be searched.
Example: "MASK, N95, LARGE" would show up in the list by tying any of the
three words. Find "large" masks by typing "LARGE" and "mask, N95, large would
be in the list as well as anything else that has "large" in the description.

What's the structure of the underlying table? What field contains the word
"large"?
 
M

MikeO

The combo box is based on the "product name" in the Products table. The user
enters the combo box and the list drops. They then type the product they are
looking for. the problem arises when the product is not listed as they expect
it to be.
Thanks
Mike
 
J

John W. Vinson

The combo box is based on the "product name" in the Products table. The user
enters the combo box and the list drops. They then type the product they are
looking for. the problem arises when the product is not listed as they expect
it to be.

Ok, I'm confused.

You want them to drop down a combo, and start typing any arbitrary text, and
have it intuit where within the field that text should be!?

You'll be able to use a *TEXTBOX* with a query to search for the product code,
but a combo autocomplete will only work if the user types the first characters
of the first displayed field.
 
M

MikeO

Thank you for your replies.
The problem we have is basically..we know what this product is but, how is
it stored in the database?
I have never based a search on a text box to pull up product data. Will it
work like an unbound combo box and pull up the product data when selected?

Mike
 
J

John W. Vinson

Thank you for your replies.
The problem we have is basically..we know what this product is but, how is
it stored in the database?
I have never based a search on a text box to pull up product data. Will it
work like an unbound combo box and pull up the product data when selected?

It could be programmed to do so.

You'ld need an unbound textbox, txtFindProduct say. What you might want to do
is have that textbox change the rowsource of the combo to limit it to just
those records which contain the string typed into the textbox. You could use
code in the textbox's AfterUpdate event to change the row source of the combo
box to something like

SELECT ProductID, ProductName FROM Products WHERE ProductName LIKE "*" &
Forms!yourform!txtFindProduct & "*" ORDER BY ProductName;

You'ld need code in the form's Current event to set it back to the complete
list.
 

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