Limit the number of records printed in a report

  • Thread starter Thread starter Ty
  • Start date Start date
T

Ty

I have a report with region, district, store, and finally
by person, sorted DESC by the number of hours worked.

For the report, I want to limit the number of records to
just the top 30 records (based on number of hours worked).

How do I do this in a report?

I can count the records, but don't know how to stop
printing the report. Actually, I want to stop printing
the report for the current district, go to the next
district, print the top 30, and so on.

Thanks in advance,
Ty
 
Ty,

This would be best worked out in the query that the report is based on.
The SQL of such a query will look something like this...

SELECT region, district, store, person, hoursworked FROM YourTable AS a
WHERE person In( SELECT TOP 30 person FROM YourTable AS b
WHERE a.district = b.district ORDER BY hoursworked DESC)
 
Back
Top