Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Report page header - setting the height

Report page header - setting the height

Report page header - setting the height

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.

RE: Report page header - setting the height

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:
Display the header for this group. Set its Repeat Section property to Yes. Use this as your new page header.

Hook'D on Access
MS Access MVP

RE: Report page header - setting the height


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

RE: Report page header - setting the height

Why don't you think the group header would work?

Did you try set the height with code in the design view?  

Hook'D on Access
MS Access MVP

RE: Report page header - setting the height

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?


RE: Report page header - setting the height

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.

Hook'D on Access
MS Access MVP

RE: Report page header - setting the height

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!

RE: Report page header - setting the height

Seems like a lot of work just to get around using the report sorting and grouping like it was meant to be. Nice coding though smile

Hook'D on Access
MS Access MVP

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close