Limit the number of records in a group that print on a report

D

dawn

I have a database that has about 5,000 records, that I need to limit the
number of records to [25] per group (Rep name). How can I accomplish this
(Preferably in the report) w/out going into VB to write code?

Thanks.

dawn
 
M

Marshall Barton

dawn said:
I have a database that has about 5,000 records, that I need to limit the
number of records to [25] per group (Rep name). How can I accomplish this
(Preferably in the report) w/out going into VB to write code?


Some code will be required.

Add a hidden(?) text box nsmed txtLine to the detail
section. Set it control source expression to =1 and its
RunningSum property to Over Group.

Then add this code to the detail section's Format event
procedure:

If Me.txtLine > 25 Then
Me.MoveLayout = False
Me.PrintSection = False
End If

Note that, if you have a unique sorting for the records,
it's usually more efficient to limit the data in the
report's record source query instead of haviing the report
process all the records only to ignore most of them. This
is a fairly advanced kind of query with a Top 25 subquery.
If you want to pursue this approach, please post details
about the data table, including field names for the primary
key and the unique sorting.
 

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