Section Detail on new page

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

I have a report set up that uses the detail section as a
table of values. The problem I am having is that I only
want four records to print per page. My group headers
take up most of the sheet and the detail section prints
near the bottom just above the page footer. What happens
is that if there are five or more records related to the
info that prints in the headers, these records print at
the top of the next page and shifts the next group headers
down.
Basically, is there a way to write in code that when it
reaches the fifth record, the group headers print again on
the next page with the next set of detail records?

Thanks,
Mark
 
I have a report set up that uses the detail section as a
table of values. The problem I am having is that I only
want four records to print per page. My group headers
take up most of the sheet and the detail section prints
near the bottom just above the page footer. What happens
is that if there are five or more records related to the
info that prints in the headers, these records print at
the top of the next page and shifts the next group headers
down.
Basically, is there a way to write in code that when it
reaches the fifth record, the group headers print again on
the next page with the next set of detail records?

Thanks,
Mark

To get the Group header to repeat on the next page, set the Group
Header Repeat Section property (it's on the Format tab) to Yes.

To limit the actual number of detail records on a page, add an unbound
control to the detail section. Set it's control source to
= 1
Set it's Running Sum property to Over Group (or Over All if
appropriate).
Name this control RunCount.
You can make it not visible if you wish.

Next, add a PageBreak control to the bottom of the section.
Code the Detail Format event:
PageBreakName.Visible = RunCount Mod 5 = 0

The detail section will be limited to 5 records.
 
Fred,

That is FANTASTIC! Thanks for the help, it works great!

I was on the right track, I had the "counter" control and
set it to running sum. Thought of the page break, but
just didn't figure out the Repeat Section property or the
coding.

Can you explain the coding for me, I don't fully
understand it. Is it setting the visible property of the
page break control equal to the "counter" control equal to
0? The last part I don't get.

Thanks again,
Mark
 
Fred,

That is FANTASTIC! Thanks for the help, it works great!

I was on the right track, I had the "counter" control and
set it to running sum. Thought of the page break, but
just didn't figure out the Repeat Section property or the
coding.

Can you explain the coding for me, I don't fully
understand it. Is it setting the visible property of the
page break control equal to the "counter" control equal to
0? The last part I don't get.

Thanks again,
Mark

Regarding: PageBreakName.Visible = RunCount Mod 5 = 0

The Visible property is either True (-1) or False (0).
The first part (PageBreakName.Visible) is either true or false
depending upon the true or false of the second part ([RunCount] Mod 5
= 0).

The Mod function returns the remainder portion of a division.
The Mod of 9/2 is 1 (9/2 = 4 with a remainder of 1)

So if RunCount = 14, the result of [RunCount] Mod 5 is 4 (14/5 = 2
with the remainder of 4). 4 is not equal to 0 so the that expression
evaluates to false and therefore visible property is false.

However, if [RunCount] = 15, then 15 Mod 5 = 0 (15/5 = 3 with 0
remainder.
Now the expression evaluates to [PageBreakName.Visible = True (because
the expression [RunCount] Mod 5 = 0 is True).

Hope this has helped.
 
Back
Top