limiting the number of records to print in a subreport

  • Thread starter Michel Khennafi
  • Start date
M

Michel Khennafi

Good afternoon:

I created a report that contains a subreport... I would like this subreport
to be limited to 20 records per page... Any idea on how to achieve this
result?

Thanks

Michel
 
M

Marshall Barton

Michel said:
I created a report that contains a subreport... I would like this subreport
to be limited to 20 records per page.


That kind of implies that the subreport details do not grow.
If they did, what would be the point of a limit?

I think you will need to create a sequence number to rank
each record in the subreport's record source query. This
can only be done if one or more fields in the query can be
used to provide a unique sort order for the records. A
simple minded query with ranking could be like:

SELECT table.*,
(SELECT Count(*)
FROM table As X
WHERE X.sortfield < table.sortfield) As Rank
FROM table

With that kind of record source, the subreport can group on
=Rank \ 20
to get 20 records per group. Then the group header section
can use its ForceNewPage property to start a new page for
each group of 20 records.

That all seems a little complicated to what you want so it
might be easier(?) to rearrange the main report's record
source to include the data now in the subreport. If that
could be done so you wouldn't need the subreport, then you
could use a page break control and a line counter text box
to start new page.
 

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