views:

517

answers:

3

I'm stuck with the following: I have an Access2003 report "rptInvoices". Group levels are on CustomerID and PackingListID.

What I like to achieve is that every 2nd (or 3rd etc.) page of an invoice starts with a blank section (of say 9cm) at the top of the page. For this I would use an empty PageHeader section. If the Report's property PageHeader had a value like NotWithGroupHeaderX, this would be easy. Since there isn't such a value: how can I hide the PageHeader on a report if there's a GroupHeader named grhCustomerID on that page?

Maybe I need a different approach, but I just don't see it.

Any help would be greatly appreciated. Bart

A: 

You can set the visible property of the page header in the format event of the group header.

Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
    Me.PageHeaderSection.Visible = False
End Sub

Private Sub Report_Page()
    Me.PageHeaderSection.Visible = True
End Sub
Remou
The code here is defective, as there is no If xxx Then statement at the beginning. One would assume you'd be testing something related to the page number.
David-W-Fenton
A: 

Remou, thanks for replying so quickly.

When I use your code, the PageHeaderSection is hidden for the entire report.

On every new page, which does not start with a GroupHeader0, I would need the PageHeaderSection to be visible. I tried:

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)
Me.PageHeaderSection.Visible = True
End Sub

but then the PageHeader is visible on all pages, although GroupHeader0_Format fires after PageHeaderSection_Format.

Let's assume a report, containing 3 invoices totalling 6 pages: Invoice1 - 3 pages Invoice2 - 1 page Invoice3 - 2 pages

Now PageHeaderSection should be hidden on page 1, 4 and 5, and visible on 2,3 and 6.

Any more suggestions would be greatly appreciated.

Bart

I have edited my reply. It is the style of Stackoverflow to put responses such as this in a comment, if short, or to edit the initial question to include the additional information, if long.
Remou
A: 

Again, thanks for your reply, but I don't understand. There seems to be missing an If-statement in your code, or should I regiser with Stackoverflow to see more of it? Also, on "my" pages 2,3 and 6, there is no GroupHeader0, so the GroupHeader0_Format won't fire there.