Making a combo box query EITHER OR instead of all.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a query which has three parameters determined by combo boxes in a form.

But the query only runs if all three combo boxes have a value selected, how
can I change the query such that if only 1 or 2 out of the 3 boxes have a
record seleted the query still runs as at the moment if you try and run it
with only 1 or 2, no records are displayed.
 
Richard Horne said:
I have a query which has three parameters determined by combo boxes in a form.

But the query only runs if all three combo boxes have a value selected, how
can I change the query such that if only 1 or 2 out of the 3 boxes have a
record seleted the query still runs as at the moment if you try and run it
with only 1 or 2, no records are displayed.

In the afterupdate event of each of the combo boxes, use a Select Case
statement to run the SQL rowsource. The Select Case statement should have 3
cases and a case else (for possible unexpected errors).
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
In the criteria line for each field that gets its argument from one of those
comboboxes put

Like "*" & forms!myform!mycombobox

That way, if the relevant combobox is empty then the criteria for the field
is "*" or ~no or any characters~

HTH
 
Back
Top