Use <All> to return all records in a query

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

Guest

I have a query that takes criteria from several combo boxes in a form. I
used a UNION clause in the Row Source to add "<All>" to the combo boxes. The
intent is to have the query return all records for a particular field when
<All> is selected. That is the part I need help with. As currently written,
the query returns no records when "<All>" is selected. I hope that it is
just a matter of using the right criteria, but I suspect there is a lot more
to it. Any help would be greatly appreciated.
 
Dear HC:

At the appropriate point in your query, add:

OR [Forms]![YourForm]![YourControl] = "All"

If you post your entire SQL of this query, I'll show you where this goes.

Tom Ellison
 
Tom,

This solution worked well...a little too well. Now the querry returns ALL
of the records. In other words, if I am sorting on multiple criteria, and
one of the criteria is set to <All>, the query returns all possible records,
including the ones that should be excluded by the other criteria.


Tom Ellison said:
Dear HC:

At the appropriate point in your query, add:

OR [Forms]![YourForm]![YourControl] = "All"

If you post your entire SQL of this query, I'll show you where this goes.

Tom Ellison


hcampbell1966 said:
I have a query that takes criteria from several combo boxes in a form. I
used a UNION clause in the Row Source to add "<All>" to the combo boxes.
The
intent is to have the query return all records for a particular field when
<All> is selected. That is the part I need help with. As currently
written,
the query returns no records when "<All>" is selected. I hope that it is
just a matter of using the right criteria, but I suspect there is a lot
more
to it. Any help would be greatly appreciated.
 
Tom,

I think I figured it out. I had to make sure I had OR statements for the
other criteria as well. Once I did that, it solved the problem. Thanks much
for the assist.

Tom Ellison said:
Dear HC:

At the appropriate point in your query, add:

OR [Forms]![YourForm]![YourControl] = "All"

If you post your entire SQL of this query, I'll show you where this goes.

Tom Ellison


hcampbell1966 said:
I have a query that takes criteria from several combo boxes in a form. I
used a UNION clause in the Row Source to add "<All>" to the combo boxes.
The
intent is to have the query return all records for a particular field when
<All> is selected. That is the part I need help with. As currently
written,
the query returns no records when "<All>" is selected. I hope that it is
just a matter of using the right criteria, but I suspect there is a lot
more
to it. Any help would be greatly appreciated.
 
Dear HC:

I think the solution would be to add parens around the one criterion.
Working this out in the design grid is a mess!

Tom Ellison


hcampbell1966 said:
Tom,

I think I figured it out. I had to make sure I had OR statements for the
other criteria as well. Once I did that, it solved the problem. Thanks
much
for the assist.

Tom Ellison said:
Dear HC:

At the appropriate point in your query, add:

OR [Forms]![YourForm]![YourControl] = "All"

If you post your entire SQL of this query, I'll show you where this goes.

Tom Ellison


message
I have a query that takes criteria from several combo boxes in a form.
I
used a UNION clause in the Row Source to add "<All>" to the combo
boxes.
The
intent is to have the query return all records for a particular field
when
<All> is selected. That is the part I need help with. As currently
written,
the query returns no records when "<All>" is selected. I hope that it
is
just a matter of using the right criteria, but I suspect there is a lot
more
to it. Any help would be greatly appreciated.
 
Back
Top