MS Access Report: How to count details with multiple groups?

C

CC

Hi, I'm at a loss here. I've searched the forums but haven't quite
found what I'm looking for.

I have a report with 2 groups set up.
Grp1 = Department
Grp2 = Type

There can be multiple 'Type's within each 'Department', however, I
want to count
the details per 'Department' and not per 'Type'.

So in effect I need to somehow be able to choose to count all details
of the 'Department', regardless of which 'Type' it belongs to. The
count number would reset for each 'Department'.

For Example:

--------------------------------------------------------------------
Deptartment: Vehicles
Type: Cars
1 Mazda
2 Ford
Type: Bikes
3 Honda
4 Suzuki
Type: Tractor
5 John Deere
6 Kubota
--------------------------------------------------------------------
The next department would have it's numbering start at #1 again.

Could anyone help me?

Thanks!
 
G

Guest

It sounds like you need to create a crosstab query. I had a similar problem
where I wanted to know how many drawings I did on a month by month basis. To
do that I created a normal query that contained the fields I needed (image
id, year, date page size) and then created the crosstab query using the
crosstab query wizard using the normal query as the input to the crosstab
query.
 
C

CC

Thanks. though I was kinda hoping that all it would take would be a
well placed textbox with =1 and summing.

Seems to me there's gotta be a way :(
 
G

Guest

To count the number of records in a group, all you have to do is place a text
box in the group header or footer section with a control source of:
=Count(*)
 
C

CC

To count the number of records in a group, all you have to do is place a text
box in the group header or footer section with a control source of:
=Count(*)

Duane,

That's not what I want to do if you read the original post.
Sorry, let me be a bit clearer.
Items that fall within the 'Detail' portion of the report need to be
numbered, however, their numbering should be reset when a new group
(GRP1) comes.

So all items (details) in GRP1 should have their own unique number to
count them. If there are 10 items in GRP1, then the items should be
numbered 1-10.

However, because there is a GRP2, the counting resets to 1 everytime
there is a GRP2 within a GRP1. The counting of items should not care
how many GRP2(sub groups) are withing GRP1.

Please see how I am counting items (mazda, ford...) in my original
post. That is how I would like it to look like.

Thanks
 
G

Guest

You should be able to create a count in the report's record source. Something
like this might work.

SELECT *, (SELECT COUNT(*) FROM tblA A WHERE A.Department=tblA.Department
AND A.Type<=tblA.Type AND A.Model<=tblA.Model) as DeptCount
FROM tblA;
 

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