Filter a Query from a Combo Box

GendoPose

Registered User.
Local time
Today, 20:50
Joined
Nov 18, 2013
Messages
175
Hi all!

Hope you guys can help.

On my database, I have 2 forms. One is to enter data into a Master table, and the other is to specify search terms for a query, and I'm having a problem with the search form.

I've got 2 combo boxes, a tick box and some text boxes which I use to specify criteria for the query. All of the text boxes and the tick box work fine, however the combo boxes are giving me trouble.

I'm using the critera Like "*" & Form![SearchForm]![Combo/Text/Whatever1] & "*" for the text boxes and tick box and this worked fine. However, no matter what way I try to use this, it doesn't work for the combo box. I've tried manipulating the Like function as much as possible, with and without the wildcards, the & signs, everything. What happens is that either they do not filter out results at all and don't affect the query, or they bring up a blank query if I leave the combo box blank.

Any help?

Thanks all!
 
What is the bound field of your combobox? At a guess without seeing your DB it is doing something like Like *2* and you're expecting Like "*foobar*"

Also you need to add quotes to your Like statement, if this really is a text key (which I'm guessing it is, since you're using wildcards). Like "'*" & Form![SearchForm]![Combo/Text/Whatever1] & "*'"
 
Both my comboboxes are unbound, and the wildcards have both got quotes around them. I've attached a version of the DB.

EDIT: The form named Planner Query is stripped down, as there was a bit of coding for creating new records, saving, navigating, etc, and it pushed it past the file size limit.
 

Attachments

Last edited:
it's alright, I managed to get it! I had to use the criteria
Not Is Null And Like "*" & [Forms]![Planner Search]![ACCOUNT HANDLER] & "*"
and now it filters everything like it should without throwing up blank results!
 
Glad to hear you got it working.
 

Users who are viewing this thread

Back
Top Bottom