Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report page header - setting the height

Status
Not open for further replies.

MikiH

Programmer
Sep 25, 2002
78
GB
Hi Everyone.

I'm having a little problem trying to set the height of the page header of a report.

I'm using textboxs with cangrow on in the report header with no problem then I'm repeating some of the same boxes in the page header (for the 2nd page).

I've found out you can't adjust the header on the onformat or onprint events.

So does anybody have any ideas?

My current thinking is:
1) open form to find out the cangrow height
(textbox cangrow height - standard height)
2) close report
3) set height of header using-
Reports![RPT_Form1].Section(3).Height = cangrow_height
4) open report


Thanks for help.
 
The page header height can only be changed in design view. You can quite often work around this by creating a new "page header" that is actually a group header based on a constant expression.

Create a new top level sorting and grouping section on a constant like:
=1
Display the header for this group. Set its Repeat Section property to Yes. Use this as your new page header.

Duane
Hook'D on Access
MS Access MVP
 
Thanks

Don't think the group header option will work with what I'm doing.

I Know you can open the report up in design mode with code. So can you then adjust the page header height from code once its been opened in design view?


Thanks again
Mick
 
Hi dhookom,

I tried what you said too and while it does work, it destroys whatever sorting I had in the underlying query. I want to programatically change the height of my report header without affecting the sorting of my records. Any other ideas?

Thanks.
 
I never rely on the sorting of the underlying query to carry through to the report. It is not reliable. Always perform your sorting and grouping in the report's sorting and grouping dialog.


Duane
Hook'D on Access
MS Access MVP
 
Thanks for the reply. Unfortunately, I designed the whole database where users either sort using queries or a sorting tab in the form.

However, I have figured out how to programatically change the report height. I used the event "PageHeaderSection_Format", then I had it call setReportHeight in order to set the height based on a hidden report that is opened:

Sub setReportHeight(ByRef rpt As Report, RevType As Integer, Optional deduction As Integer = 0)
Dim rptRev
Dim beforeHeight As Integer, maxRevHeight As Integer, newRevHeight

beforeHeight = rpt.PageHeaderSection.Height
maxRevHeight = rpt!sbrList_RevInfo.Height
DoCmd.openReport "sbrList_RevInfoHeight", acViewPreview, "", "ListType=" & RevType, acHidden
Set rptRev = Reports.Item("sbrList_RevInfoHeight")
newRevHeight = rptRev.getRevHeight() '800
If newRevHeight > maxRevHeight Then
rpt.PageHeaderSection.Height = beforeHeight + (newRevHeight - maxRevHeight) / 2 - deduction '/2 because this function is called twice
End If
DoCmd.Close acReport, "sbrList_RevInfoHeight"
End Sub

In this case, "sbrList_RevInfoHeight" is my hidden report while "sbrList_RevInfo" is the control with CanGrow=True in the original report page header. I tested it and it works, pretty neat huh? Now my report page headers grow!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top