How do I count, with criteria, a group of records on a report?

G

Guest

Access 2000/03.
I have a report that is grouping data on a single field based on a single
query. All the detail records I need are there to count but are not visible.
I added an Unbound Control to the GroupHeader Section to count the number of
total records in each group. Works perfectly! (Example, there are 10 Parts
in the first group, 2 in the second, 3 in the third, etc.) Now I need to
figure out how add a second Control to count how many of those records in
each group meet specific criteria. (Example, there are 8 Parts in the first
group that have a PartType of "Stock", 0 in the second, 2 in the third, etc.
I've tried all kinds of things but haven't been able to get it. The DCount
function wants to refer back to the underlying query and ends up counting
"all" the records not the records per group. Is code attached to the
GroupHeader the only option I have...
Help?
 
F

fredg

Access 2000/03.
I have a report that is grouping data on a single field based on a single
query. All the detail records I need are there to count but are not visible.
I added an Unbound Control to the GroupHeader Section to count the number of
total records in each group. Works perfectly! (Example, there are 10 Parts
in the first group, 2 in the second, 3 in the third, etc.) Now I need to
figure out how add a second Control to count how many of those records in
each group meet specific criteria. (Example, there are 8 Parts in the first
group that have a PartType of "Stock", 0 in the second, 2 in the third, etc.
I've tried all kinds of things but haven't been able to get it. The DCount
function wants to refer back to the underlying query and ends up counting
"all" the records not the records per group. Is code attached to the
GroupHeader the only option I have...
Help?

=Sum(IIf([PartType] = "Stock",1,0))
=Sum(IIf([PartType] = "SomethingElse",1,0))
etc.
 

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