count groups

G

GBA

I know the count() method to count records....but am drawing a blank as to
whether there is a method to count groups....

i.e. the name appears on every record...I have grouped by name.... I would
like to count the number of unique names (i.e. groups)....but a Count(Name)
gives the count of all records....

any solution?
 
G

GBA

As I understand you - that would be a query based solution outside the report.

No way to do within report?
 
M

Marshall Barton

GBA said:
I know the count() method to count records....but am drawing a blank as to
whether there is a method to count groups....

i.e. the name appears on every record...I have grouped by name.... I would
like to count the number of unique names (i.e. groups)....but a Count(Name)
gives the count of all records....


Add a text box (named txtCount) to either the group header
or footer section. Set the text box's control source to =1
and RunningSum to Over All.

Then a report footer text box can display the total by using
the expression =txtCount

If you do not have a group header or footer, create one and
make it invisible.
 
J

John Spencer MVP

If you are grouping by name then add a textbox control (txtCountNames) to the
group level and set its source to =1 and set it to count overall.

In the report footer, add another control (txtTotalCountNames) and set its
source to =[txtCountNames]

You can set the visible propery of txtCountNames to false (No) to hide it from
view when printing.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
G

GBA

aha - - I get it....thanks all.



Marshall Barton said:
Add a text box (named txtCount) to either the group header
or footer section. Set the text box's control source to =1
and RunningSum to Over All.

Then a report footer text box can display the total by using
the expression =txtCount

If you do not have a group header or footer, create one and
make it invisible.
 

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