Multiple combo's to filter qry

Roscoe24

User for 10 years
Local time
Today, 07:59
Joined
Nov 18, 2003
Messages
24
I've read so many topics on the forum about this I've got myself going in circles... (3 days of searching)

I have a FormA with 8 possible unrelated combo's (cmb1, cmb2, etc) populated.

I now need to set the criteria in my qry (qry1) based on any combination of combo's having something in - or perhaps just one combo >"". (All text) FYI: My overall aim is to produce a graph.

Please can anyone paste some working code for me to adapt? And advise how qry set up e.g. no filters/criteria applied. I have a btnA to activate code.
 
I am assuming that each combo represents what would be wanted to be selected under an individual field. So, 8 combos - 8 fields, one combo for each. Is that correct?

If so, under the criteria (in the Query By Example Grid) put on ONE LINE of the criteria:

[Forms]![YourFormNameHere]![cmb1] OR [Forms]![YourFormNameHere]![cmb1] Is Null


for the next field

[Forms]![YourFormNameHere]![cmb2] OR [Forms]![YourFormNameHere]![cmb2] Is Null

...etc.

making sure to change YourFormNameHere to the name of the form that has the combos. (By the way please make sure to name your combo's something meaningful - like cboEmployeeID for an EmployeeID field, or something like that so that it isn't hard for someone else to come in and know what is related to what. Or a year down the line you won't have forgotten and need to go look.
 
Last edited:
I can't believe it's that simple! Thank you so so much. I'd got myself all in a tiz with information overload.
(BTW I note your comment re naming and in the project use sensible names e.g. cmbCountry; cmbYear; etc.) Thanks again - and may I say that I often read your tips and am very grateful for your wide ranging advice.
 

Users who are viewing this thread

Back
Top Bottom