Smart questions
Smart answers
Smart people
Join Tek-Tips Forums
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • 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!

Join Tek-Tips
*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.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

MikiH (Programmer) (OP)
20 Aug 10 3:11
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.
dhookom (Programmer)
20 Aug 10 10:31
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

MikiH (Programmer) (OP)
23 Aug 10 2:54
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
dhookom (Programmer)
23 Aug 10 8:16
Why don't you think the group header would work?

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

Duane
Hook'D on Access
MS Access MVP

JBruAustin (Programmer)
12 Oct 10 17:46
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.
dhookom (Programmer)
12 Oct 10 18:27
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

JBruAustin (Programmer)
12 Oct 10 19:02
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!
dhookom (Programmer)
12 Oct 10 22:12
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

Duane
Hook'D on Access
MS Access MVP

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!

Back To Forum

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