Query muliti-criteria to be entered from 5 Form combo boxes???

HappyBunny

Registered User.
Local time
Today, 04:36
Joined
Jun 6, 2008
Messages
22
How do I link my Query to my Form with 5 independent of each other drop-down lists of criteria selectors(combo boxes). I want to have a "Run Query" Button on the form opening the query and showing the query recordset for the selected values?? Thanks
 
I am not sure if I understand your question so I'm going to give you two answers.
1. Assuming the combos are being used to select which query to run: In the click event of the button, use a nested If statement to check the combos to determine which query to run.
2. Assuming the combos are supplying selection criteria to a single query: Open the query in SQL view (and NEVER save it in QBE view or Access will recode the selection criteria). For each combo, you need a clause in the format:
(FieldA = Forms!YourForm!CboA OR Forms!YourForm!CboA Is Null)
You would then connect each clause with the AND operator. The parenthes are critical since the complex condition will contain both And and Or operators. If what you ment by independent is that the combo criteria should be combined with Or's then the criteria statement is much simpler.
FieldA = Forms!YourForm!CboA OR FieldB = Forms!YourForm!CboB OR FieldC = Forms!YourForm!CboC ....
 
Thanks Pat :D
 

Users who are viewing this thread

Back
Top Bottom