You are probably right about the nulls.
Typically people put this kind of thing in their query:
Like [Forms].[Form1].[Combo2] & "*"
However, that criterion does NOT return the records where the field is null.
It is possible to write the WHERE clause of the query so the criterion is
True if the combo is null, e.g.:
WHERE (([Forms].[Form1].[Combo2] Is Null)
OR ([MyField] Like [Forms].[Form1].[Combo2] & "*"))
AND ...
You can probably see this gets very convoluted if you have lots of criteria.
A much more efficient solution is to leave the criteria out of the query,
and build the it as a string using only the boxes where the user entered
something. You can then apply it as the WhereCondition for OpenReport, the
Filter of your form, or even as the SQL property of a QueryDef.
For an example, see:
Search form - Handle many optional criteria
at:
http://allenbrowne.com/ser-62.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
sunshineleo said:
I have a search form with combo boxes.... I don't understand why if there
are
700 records, only 620 show up in the query results when nothing is
selected.
I think it may be because some of the fields included in the search have
nothing in the field, or they are Null. How do I overwrite this?
Thanks for the help!