Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report: Selective Counting

Status
Not open for further replies.

mercy

Technical User
Jan 29, 2002
10
GB
I'm setting up a Database for employees. Some are Full Time others Part Time. My Report lists employees by Department and shows their status (Full time or Part Time).

I want to be able to count:

1) all personnel in the Department
2) only those in the Department who are Full Time
3) only those in the Department who are Part Time.

To count all personnel is not the problem. I use the following:
=Count([StaffStatus])

To do a selective count is the problem. I've tried the following: =Count([StaffStatus]="FullTime")
=Count([StaffStatus])-Count([StaffStatus]="PartTime")

These don't work for me. They count the total entries, regardless of whether they are Full Time or Part Time.

I put the "count" code in the Sector Footer of the Report

Please Help!
 
You can put an unbound control at the sector footer of the report and put a SQL statement in the Control Source of that control that would do a DCount on records from the table that have a criteria of StaffStatus="Full Time".

It would read something like:

= DCount("[StaffStatus]", "Table Name", "[StaffStatus]='Full Time'")

This should do it.

Moe Dweck
Data-trieve, Inc.
 
Another way to accomplish this is to put the folllowing code in the Control Source for your three count Textboxes.
=Sum(IIf([StaffStatus]="FullTime",1,0))
=Sum(IIf([StaffStatus] = "PartTime",1,0))
=Count([StaffStatus])
The Sum of 1's produces the same value as Count.
Paul
 
Thanks a million, you're both stars.

Nik
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top