Formating the 'Details section' of report

P

Patrick

HI!!

I was wondering if I can programmaticaly format the
details section of a report.

What I mean:
Lets say my page(8-1/2 by 11") is 'landscape' and formated
the way I want. Lets say that on that page
I can sqeeze-in 10 rows of data(formated to my liking).

Now, Lets say that a group as 11 rows of data, 10 should
go on the first page and the rest on the following page
right!!
Could I change that to make it look nicer. Maybe 6 on the
first page and the other 5 on the next one..

Can I do that!!! if so could you tell me how its done.
If not, any alternatives would be welcome.

Thanks in advance,
PAtrick
 
M

Marshall Barton

Patrick said:
I was wondering if I can programmaticaly format the
details section of a report.

What I mean:
Lets say my page(8-1/2 by 11") is 'landscape' and formated
the way I want. Lets say that on that page
I can sqeeze-in 10 rows of data(formated to my liking).

Now, Lets say that a group as 11 rows of data, 10 should
go on the first page and the rest on the following page
right!!
Could I change that to make it look nicer. Maybe 6 on the
first page and the other 5 on the next one..

Can I do that!!! if so could you tell me how its done.
If not, any alternatives would be welcome.


Are you sure it's worth the effort just for a fairly minor
cosmetic benefit?

I won't guarentee this to work under all combunations of
settings for KeepTogether CanCrow/CanShrink in your report,
but here goes.

Add a text box named txtGrpCount to the group header section
(create the group header if you haven't already) with the
expression =Count(*).

Add a text box named txtLineCount to the detail section, set
its control source expression to =1 and RunningSum property
to Over Group.

Add a Page Break control named pgNewPage at the very bottom
of the detail section.

Now, set the group header and detail section's OnFormat
properties to [Event Procedure], then add this pile of only
partially tested code so the report's module looks something
like.

Private GrpPages As Long
Private PagesRemaining As Long
Private LinesPrinted As Long

Sub GroupHeader1_Format(. . .
Dim txtLineCount As Integer
LinesPrinted = 0
GrpPages = (txtGrpCount + 10 - 1) \ 10
PagesRemaining = GrpPages
End Sub

Sub Detail_Format(. . .
Dim LinesPerPage As Long

LinesPerPage = (txtGrpCount - LinesPrinted _
+ PagesRemaining - 1) \ PagesRemaining
If ((txtLineCount - LinesPrinted) Mod LinesPerPage) = 0 _
And txtLineCount <> txtGrpCount Then
PagesRemaining = PagesRemaining - 1
LinesPrinted = txtLineCount
End If
End Sub
 

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