Limit the number of records printed in a report

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
 
S

Steve Schapel

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)
 

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

Top