# Solved: Creating a Multi-Criteria Search Form, Access 2007



## Dobber92 (Jul 21, 2011)

I'm fairly new to Access, and I'm looking for a way to make a search form that has both text boxes and combo boxes associated with fields in my table, titled Tbl_DCR. I want to be able to select certain field values and have either a sub-form or the datasheet section of a split-form display any records that have that field value in them. So if I selected values from two different combo boxes, it would only display records that have both field values in them, and so on. I'm running Access 2007 on XP. Please help!


----------



## Rockn (Jul 29, 2001)

Try setting up a basic select query and get that working the way you want with the criteria you want. This will help with how you will build your form and display the underlying data.


----------



## OBP (Mar 8, 2005)

You can either do as Rockn suggests and use a Query with Criteria to provide the data for your form/subform or you can use VBA code to set the Form's Filter Property.
To see a very good example database have a look at the attached database originally created & posted by Allen Browne in 2006.


----------



## Dobber92 (Jul 21, 2011)

OBP said:


> You can either do as Rockn suggests and use a Query with Criteria to provide the data for your form/subform or you can use VBA code to set the Form's Filter Property.
> To see a very good example database have a look at the attached database originally created & posted by Allen Browne in 2006.


That example database exactly what I'm looking for. Allen did a very good job at describing the code logic. However, the filter did not work when I tried it. I'll try to use this on my database anyways, but you may want to take a look at the example yourself and see if there's anything wrong with it.

Thanks!


----------



## Dobber92 (Jul 21, 2011)

Nevermind! The office security had disabled the filtering for some unknown reason. The filter works perfectly, and I'm confident it will work for my database. Thankyou!

Dobber92


----------



## Dobber92 (Jul 21, 2011)

I noticed in that example database that value lists were used to create the options in the filter combo boxes. Seeing as I have over 60 choices, is there a way to mess with the row course or something like that to directly link the combo box to the table field without screwing up the filtering capabilities?

Thanks!


----------



## Rockn (Jul 29, 2001)

Yes, that is the preferred way to do it from a table. You just may need to change the criteria that sets the content of the second combo.


----------



## Dobber92 (Jul 21, 2011)

Ok I got the combo boxes to work. My problem now is that the subform is displaying the ID numbers of my combo box field values instead of their text values. Any ideas on how to fix that?


----------



## Rockn (Jul 29, 2001)

Is it a subform or a listbox? The subform should pull in whatever you have listed in the query that builds the form. If you are only bringing in the ID field that is all you will see.


----------



## Dobber92 (Jul 21, 2011)

The query that my sub-form is based upon is created from a request table that used the lookup wizard to create a combo box for the individual from another table titled Individual table. When I open the query it displays the names like it's supposed to, but the sub form displays the IDs


----------



## Rockn (Jul 29, 2001)

And you have the fileds (controls like text boxes) like names listed in the subform as well??


----------



## Dobber92 (Jul 21, 2011)

I'm not sure what you're asking. The fields in my sub-form are the same as my query. When I did the lookup wizard, it made the feild format Number instead of text box. Does that make a difference?


----------



## Rockn (Jul 29, 2001)

Can you post the database again?


----------



## Dobber92 (Jul 21, 2011)

I can't upload the database because there is sensitive info on there


----------



## Dobber92 (Jul 21, 2011)

I fixed it. I had get rid of the relationships associating the IDs with the other table and create new relationships linking the text value fields. They're unique, so I shouldn't have to worry about duplicate records


----------

