Hi,

I got a crystal report with:-

main report
subreport(Item_A)
subreport(Item_B)

There is a limit for the subreport to show only 5 record, if there is more then 5 records it should go to a new page. I have been trying to do this for 1 week, i tried so many codes and tried changing the new page but the the records dont seem to go to the new page. I got 10 records, when i print it's only printing the first 5 records, the balance 5 it doesnt show... and it doesnt show any new page. The SQL is locked to TOP 5 records? Any idea?

Dani AI

Generated

A reliable way to get exactly five subreport rows per page is to force paging from inside the subreport rather than relying on the parent report. was right to check that detail fields are in the Details section and was right to check the DB rows — both are quick sanity checks — but the usual working solution is to group on a small formula that buckets every five records and then tell that group to break the page.

Steps (inside the subreport):

  1. Add a formula (name it e.g. {@PageGroup}) with this code:
WhilePrintingRecords;
Int((RecordNumber - 1) / 5)
  1. Group the report on {@PageGroup}. Put your row fields in Details.
  2. In Section Expert for the group (use the group footer), enable "New Page After" and check "Except for last" to avoid a trailing blank page.
  3. Preview the subreport by itself to confirm it creates pages with 5 rows each.

If preview still shows only five rows, check these common causes:

  • The subreport query or stored proc may be returning only 5 rows (Database -> Show SQL Query inside the subreport) or a Link to Main Report may be passing a parameter that limits results.
  • The subreport might be an On‑Demand subreport (Format Subreport -> Subreport tab) — disable On‑Demand to print full content.
  • In the parent report, ensure the subreport object is not constrained by "Keep Object Together" (uncheck to allow normal paging) or by section-level suppression/page settings that prevent the subreport pages from printing.
  • If supplying data from C#, ensure you pass the full table to the subreport (example: report.Subreports["Item_A.rpt"].SetDataSource(myDataSet.Tables["ItemA"]);).

Putting the page-break logic inside the subreport is the most robust approach: it guarantees groups of five rows per subreport page regardless of how the parent report repeats or arranges the subreport.

Recommended Answers

All 6 Replies

Hi anyone? i still couldnt solve this.. please help... i need it today..

in your sub reports did you put the field in other than details section.....
i feel it should have in Details section..

sorry i dont get u?

in your crystal report (ie .rpt file) you have multiple sections like header, details, footer section.. if you put your field value in other than details section it doesn't expand according to increment of data. when you have multi row data you must put it in details section.

there are no limitation in crystal report, you may check number of your records in database

The subreport are placed in the details section...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.