开发者

Access Report: Page header on second page on per detail

I want to display a header only on the second page and beyond but PER record. The first page of the new detail should not have the page header visible.

Originally I had the following code

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCoun开发者_如何学Ct As Integer)
    Me.PageHeaderSection.Visible = Not (Me.Page = 1)
End Sub

It displays the header on everyother page except the first.

I want the header to be visible after the first page (but not including the first page) for each group.


Way too complicated.

The first one was better!

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)

    Me.PageHeaderSection.Visible = Not (Me.Page = 1)
    Debug.Print "Page " & Me.Page & " Visible = " & Not (Me.Page = 1)

End Sub


In the Sorting and Grouping for the report, add the field that identifies the record and that you want to group on. In the OnFormat event of that section header, do the same thing you're doing above: RecordHeader.Visible=(Me.Page<>1)


I created this simple sub that seems to do the trick. Basically, for each page, it checks if the group is the same as before. If it is different it assumes that it is the first page of the group and doesn't display the header.

'At the top of the module window I created a "Module-Level Variables".
Dim current_group As Integer
Dim temp_group As Integer

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)

    current_group = Int(Me.MyGroupID)

    If current_group = temp_inst Then
        Me.PageHeaderSection.Visible = True
    Else
        Me.PageHeaderSection.Visible = False
    End If

    temp_group = current_group    
End Sub
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜