Details size when subreport included

T

Tezza

i have a subreport feeding the Details section of a report. the number of
records the subreport returns varies. This has the unfortunate habit of
pulling the footer up so that the contents lie just below the subreport (the
fewer records returned, the higher up the page are the footer controls).

i want these controls to always appear at the bottom of the page no matter
how many records are returned on the subreport. I've tried some code using
twip values to adjust the height of the Details section but i've not had
much luck.

Any bog-standard method i'm missing?

tia
terry
 
M

Marshall Barton

Tezza said:
i have a subreport feeding the Details section of a report. the number of
records the subreport returns varies. This has the unfortunate habit of
pulling the footer up so that the contents lie just below the subreport (the
fewer records returned, the higher up the page are the footer controls).

i want these controls to always appear at the bottom of the page no matter
how many records are returned on the subreport. I've tried some code using
twip values to adjust the height of the Details section but i've not had
much luck.

Any bog-standard method i'm missing?


No. This has always been a nasty situation.

Beginning with AXP (where you can change the detail
section's Height), there is a reasonable, if tricky,
approach to the problem. Here's the relevant code for a
subreport's module that seems to do what you want:
'-------------------------------------------------------------
Const TPI = 1440 ' Twips per Inch
Const FooterPos As Long = 9 * TPI
Private lngDetailHeight As Long

Private Sub Detail_Format(Cancel As Integer, FormatCount As
Integer)

If txtLineCount = txtGrpLines Then
If Me.Top <= FooterPos - lngDetailHeight Then
Me.Section(0).Height = FooterPos - Me.Top
End If
Else
Me.Section(0).Height = lngDetailHeight 'Reset
Height for normal details
End If
End Sub

Private Sub Report_Open(Cancel As Integer)
lngDetailHeight = Me.Section(0).Height
End Sub
'-------------------------------------------------------------
txtLineCount is a detail section, =1, RunningSum text box to
count details and txtGrpLines is a header section text box
with the expression = Count(*). These are used to determine
when you are processing the last detail before the footer.
The 9 in the second Const statement is the position on the
page where you want the footer to appear.

Note that this is a "delicate" situation. By "delicate", I
mean that things can go completely haywire if you make some
seemingly innocuous change such as using KeepTogether in the
wrong(?) place or by making the footer a little too big to
fit in the space allowed.
 
T

Tezza

Marshall Barton said:
No. This has always been a nasty situation.

Beginning with AXP (where you can change the detail
section's Height), there is a reasonable, if tricky,
approach to the problem. Here's the relevant code for a
subreport's module that seems to do what you want:
'-------------------------------------------------------------
Const TPI = 1440 ' Twips per Inch
Const FooterPos As Long = 9 * TPI
Private lngDetailHeight As Long

Private Sub Detail_Format(Cancel As Integer, FormatCount As
Integer)

If txtLineCount = txtGrpLines Then
If Me.Top <= FooterPos - lngDetailHeight Then
Me.Section(0).Height = FooterPos - Me.Top
End If
Else
Me.Section(0).Height = lngDetailHeight 'Reset
Height for normal details
End If
End Sub

Private Sub Report_Open(Cancel As Integer)
lngDetailHeight = Me.Section(0).Height
End Sub
'-------------------------------------------------------------
txtLineCount is a detail section, =1, RunningSum text box to
count details and txtGrpLines is a header section text box
with the expression = Count(*). These are used to determine
when you are processing the last detail before the footer.
The 9 in the second Const statement is the position on the
page where you want the footer to appear.

Note that this is a "delicate" situation. By "delicate", I
mean that things can go completely haywire if you make some
seemingly innocuous change such as using KeepTogether in the
wrong(?) place or by making the footer a little too big to
fit in the space allowed.

thanks a lot marsh, i'll check out that code in the cold light of day. looks
a little advanced for my amateur brain.

terry
 

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