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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting records in a report

Status
Not open for further replies.

Gooter

Technical User
Apr 5, 2002
20
US
Looking for help counting records on a report. Here is how I have my database setup. Note, I am a very novice Access user. :)

Tables: Fields
1. DPM Name: DPM UID, Name, Location [NOTE: a DPM name may have multiple locations, eg. DPM A located at P1/S2 and P2/S4, so each DPM name and its various locations has its own UID.)
2. Violations: DPM UID, Violation UID, Rule #, Fine Amount

DPM UID is linked to Violations UID. So, when inputting a new violation, it pulls the DPM information from the DPM table.

==============
On a report, I want to display how many times a DPM and its separate locations, if applicable, was in violation.
==============

Violations table has these records:
DPM Name | Location | Rule # | Fine Amt

DPM A | P2/S4 | Rule 5 | $50
DPM A | P2/S4 | Rule 5 | $75
DPM A | P2/S7 | Rule 5 | $25

==============

On the report, I want it to display:
DPM Name | Location | Rule # | Fine Amt | # Times in Violation

DPM A | P2/S4 | Rule 5 | $50 | 2
DPM A | P2/S4 | Rule 5 | $75 | 2
DPM A | P2/S7 | Rule 5 | $25 | 1

If I use the count function and count how many times a DPM Name appears, then I'll get a total of 3 rather than 2 and 1.

**I want it to count as I have shown above.**

Initially, I thought I could create a field in the Violations Table called Viol# and put a number in it each time a DPM and its location(s) has a violation BUT the count needs to be calculated based upon a prior 24 month period.

Any help is greatly appreciated!
Thanks!




 
Forgot to mention...

I am thinking that a possible solution is to somehow count the DPM UID for each violation since it is different for each DPM and its locations?

 
Make your recordsource for this report a query...make it a totals query where you group by Name, Location, Rule #, and Amt and then count the primary key. This should give you exactly the data you need. Hope that helps.

Kevin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top