Re: Search Form, # of Records
- From: "Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx>
- Date: Fri, 15 Dec 2006 11:26:34 +0900
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
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"sunshineleo" <sunshineleo@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:6A4FA762-436D-4AA1-B005-3BA18227B1B2@xxxxxxxxxxxxxxxx
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!
.
- Follow-Ups:
- Re: Search Form, # of Records
- From: sunshineleo
- Re: Search Form, # of Records
- Prev by Date: Re: Getting external data from Excel.
- Next by Date: RE: Macro Not Working
- Previous by thread: Re: Visible fields problem
- Next by thread: Re: Search Form, # of Records
- Index(es):
Relevant Pages
|