Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Sep 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    181
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Pageheader in Report (Access 97)

    Hi

    I hope there is a simple answer to this apparently simple problem. I wish to give the user the option of whether the report prints the page header information (basically label and page number fields) or not. However, I can not find any code giving the option to suppress (ie visible false) the page header. The reason being is they may wish to export the report to Word and add in their own header details in Word header rather than use those in the report.

    As alternative I guess I could suppress all the label and page number fields, but this is the less desirable option. Also, I presume I should put the message box and code via the report open event.

    Any advice appreciated.

    Thanks & Regards

    WTH

  2. #2
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Royal Oak, Michigan, USA
    Posts
    255
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Pageheader in Report (Access 97)

    Hi,
    I used an old form titled frmInvites and added a checkbox titled bolHeader. If it is checked, I want to include the header. If it is unchecked, I want to exclude the header. Therefore, on the on format property of the Page Header, insert the following text. You could also use a combo box or other method to allow the user to indicate whether to include the header or not.
    Good Luck!

    If [Forms]![frmInvites]![bolHeader] = -1 Then
    Me.PageHeaderSection.Visible = True
    Else: Me.PageHeaderSection.Visible = False
    End If

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Pageheader in Report (Access 97)

    In fact, it is sufficient to set the Visible property of the page header section once, in the On Open event of the report:

    Private Sub Report_Open(Cancel As Integer)
    Me.PageHeaderSection.Visible = [Forms]![frmInvites]![bolHeader]
    End Sub

    Once the property is set, it will stay that way (unless it is reset explicitly), so there is no need to keep on setting it in the On Format event of the page header section.

  4. #4
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Royal Oak, Michigan, USA
    Posts
    255
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Pageheader in Report (Access 97)

    Brilliant. Thanks Hans!

  5. #5
    2 Star Lounger
    Join Date
    Sep 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    181
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Pageheader in Report (Access 97)

    Hi

    Thanks for the advice. However, I can't find the reference PageHeaderSection. Are you sure it is available in Access 97?

    Regards
    WTH

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Pageheader in Report (Access 97)

    PageHeaderSection is not a VBA keyword, you should replace it by the name of the page header section in your report. Click on the bar at the top of the page header in design view; the Properties window will tell you what its name is.

  7. #7
    2 Star Lounger
    Join Date
    Sep 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    181
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Pageheader in Report (Access 97)

    Hi

    Ahhh, all is enlightened (thanks). The code Me.Section(3).Visible = False did the trick. I did note that Access 2002 does have available the option pageheadersection in VBA. This is a more logical appropriate to avoid traps for beginners such as me.

    Regards
    WTH

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •