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