Use <All> to return all records in a query

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.
 
T

Tom Ellison

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
 
G

Guest

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.
 
G

Guest

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.
 
T

Tom Ellison

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top