Totaling the number of records on a report

  • Thread starter Thread starter Total number of entries
  • Start date Start date
T

Total number of entries

I have a report that contains employee information. I need the report to
total the number of employees in the footer. How can I do this?
 
"Total number of entries" <Total number of
(e-mail address removed)> wrote in message
I have a report that contains employee information. I need the report to
total the number of employees in the footer. How can I do this?

Create a text box, with a Control Source using the Count function on a field
such as the unique identifier of the record.

Larry Linson
Microsoft Office Access MVP
 
Thanks Larry.... I must be missing something because it gives me a #error.
It works when I do it in a form, but not on the report for some reason....
This is what I'm doing:
=Count([Employee])
 
=DCount("[Employees]","[ReportDataSource]")
where ReportDataSource is the actual name of your report's datasource

WorkingGirl said:
Thanks Larry.... I must be missing something because it gives me a #error.
It works when I do it in a form, but not on the report for some reason....
This is what I'm doing:
=Count([Employee])

Larry Linson said:
"Total number of entries" <Total number of
(e-mail address removed)> wrote in message


Create a text box, with a Control Source using the Count function on a field
such as the unique identifier of the record.

Larry Linson
Microsoft Office Access MVP
 
How you do it depends on where you want the count to show, and whether the
report is grouped by employee or not.

If you simply want to count all rows in a group, e.g. employees per
department, or the whole report you can use =Count(*) as the ControlSource of
a text box control in a group or report footer as appropriate.

Is this in a page footer? If so you cannot use an aggregate function;
that's only possible in a group or report footer. To count per page do as
follows:

Add an unbound text box, txtPageCount say, to the page footer. In the page
header's print event procedure initialise the text box to zero with:

Me.txtPageCount = 0

In the Print event procedure of the detail section increment the value of
the text box:

If PrintCount = 1 Then
Me.txtPageCount = Me.txtPageCount + 1
End If

That assumes that there is one employee per detail. If the report is
grouped by employee then increment the text box in the employee group
header's Print event procedure rather than the detail section's.

If you want a cumulative count in the page footer rather than a count per
page then initialise the text box to zero in the report header's print event
procedure rather than the page header's.

If the report is grouped by employee and you want a total of all employees
in the report footer then put the txtPageCount control in the report footer
rather than the page footer, initialise it to zero in the report header's
event procedure and increment it in the employee group header's event
procedure.

Ken Sheridan
Stafford, England

WorkingGirl said:
Thanks Larry.... I must be missing something because it gives me a #error.
It works when I do it in a form, but not on the report for some reason....
This is what I'm doing:
=Count([Employee])

Larry Linson said:
"Total number of entries" <Total number of
(e-mail address removed)> wrote in message


Create a text box, with a Control Source using the Count function on a field
such as the unique identifier of the record.

Larry Linson
Microsoft Office Access MVP
 

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

Back
Top