Quantcast
Viewing latest article 3
Browse Latest Browse All 7

Criteria in a Query

Peter,

[Medium 1] is the field name of the table.  I am trying to ask the query to show all records if the combo box on my form is empty.  Your formula worked, except it only worked if I used it on one column of the query (one field of the table).  I am trying to filter on 5 different fields of the table.  I have 5 combo boxes on a form to fill in with options to filter on.  However, if they only want to fill in one box, I want the query to filter on that one, and show all records for all the other fields.  The problem I run into, is that it will do what I want, as long as there isn't a null value in the record.  If there is a null value in any of the other 4 feilds within the table, it won't show those records in the query.

I hope I explained this well enough.  I put an example below that we can all relate to.  I am not familiar enough with SQL to write the equation there.  I would like to write the equation on query criteria if possible, but if not, please indicate where I need to start.

Below is an example of what I am trying to do:

Table of cars

Make:

Model:

Year:

Color:

Horse Power:

I want to be able to filter on any of these 5 fields in the table using combo boxes on a form.  However, if I only fill in the Combo box for "Make" on my form that is linked to the query with "Ford", I want it to show me all the "Ford" cars in the table.  However, if the color or horse power are left blank because they are not required, I still want to have the query show me all the "Ford" cars and just show blanks for the color and horsepower.  If I want a "Ford" that is an "F-150" that is "Black", I would like it to show me all the records for those three criteria.

Thanks for all your help,

Curtis

 


Viewing latest article 3
Browse Latest Browse All 7

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>