Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Combo Boxes on Search Form 1

Status
Not open for further replies.

mtownbound

Technical User
Jan 28, 2002
293
US
If I use regular text boxes and type any of the values, the query works properly. If I use combo boxes and select the values from the dropdowns, the query doesn't return any values. Here are the criteria I'm using for both the text fields and the combo boxes:

Like "*" & [Forms]![Form1]![txtCompany] & "*"
Like "*" & [Forms]![Form1]![Last Name] & "*"
Like "*" & [Forms]![Form1]![First Name] & "*"

Any ideas?

Thanks!!!
 
I expect the bound columns of the combo boxes are ID type fields and not the actual displayed text. I could be wrong since you haven't provided Row Source and Bound Column information for the combo boxes.

Duane
Hook'D on Access
MS Access MVP
 
Probably because the combobox default stored value is an ID instead of the actual text you're trying to query against. That's what I would guess. So, for instance, if txtCompany were cboCompany, and each Company is in a table that has a CompanyID, then if you used the ComboBox wizard to setup that control, it defaults to storing the value of the ID, not the text value.

So you can go a few different directions:
1. You can change the value that is stored from the ID to the text value
2. You can reference the Columns of the combo box.. most likely, you'll be looking for Columns(1) or Columns(2) - depends upon whether there is a Columns(0) or not - I forget, and have to test every time I use that.
3. You could try referencing the ComboBox's text value
4. You can rewrite your query to look for the IDs rather than the text valeus.

If you do option 2 or 3, you may have to use some VBA, and say setup a UDF, and then query from that, but I honestly don't remember.

"But thanks be to God, which giveth us the victory through our Lord Jesus Christ." 1 Corinthians 15:57
 
Thanks for the responses, it was the Bound Column! Moving too fast!!!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top