Using parameter on table with group by

D

Dave G.

I have a report that I am capturing various parameters
(via a form) and then calling the report with a
DoCmd.openReport and passing the strWhereCategory.

The issue is that the query that the report is based on
does a group by (e.g. 3 columns, see below) since those
are the only fields that I want. However, the where
clause filter is based on fields that are in the table,
but not in the select list (due to the group by).

When I run the report, i get prompted to enter the
parameter. If I hardcode the fld4 criteria in the query,
it works fine. I'm assuming it prompts me from the report
because the fld4 is not in the select list. Is the only
way to dynamically filter the report on fields that are
actually in the select list? Is there any work around for
this?

Thanks,

Dave

Example (Note: Employee is a linked table)
table: Employee
fields: fld1, fld2, fld3, fld4

select fld1,fld2,fld3
from Employee
where fld4 = '10' <--fld4 is the filter parameter!
group by fld1,fld2,fld3
 

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