Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Page footer not displaying in grouped report

Status
Not open for further replies.

kellbell

Technical User
Jun 20, 2007
12
US
I have created a report with 2 grouping levels - FSID & Department. I labored long & hard to find code so that the page header and footer would not display on the initial page of each FSID grouping. My code nearly works...except on page 2. Below is my code:
Code:
Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)
    Dim i As Integer
    
    If Me.Pages = 0 Then
        ReDim Preserve grpArrayPage(Me.Page + 1)
        ReDim Preserve grpArrayPages(Me.Page + 1)
        GrpNameCurrent = Me.FSID
        If GrpNameCurrent = GrpNamePrevious Then
            grpArrayPage(Me.Page) = grpArrayPage(Me.Page - 1) + 1
            intGrpPages = grpArrayPage(Me.Page)
            For i = Me.Page - ((intGrpPages) - 1) To Me.Page
                grpArrayPages(i) = intGrpPages
            Next i
        Else
            intGrpPage = 1
            grpArrayPage(Me.Page) = intGrpPage
            grpArrayPages(Me.Page) = intGrpPage
           
            
        End If
    Else
        Me.txtGrpPages = "Group Page " & grpArrayPage(Me.Page) 
        
    End If
    
    Me.txtGrpPages = "Group Page " & grpArrayPage(Me.Page) & ""
    'of " & grpArrayPages(Me.Page)
    GrpNamePrevious = GrpNameCurrent
    
    'now code to determine whether or not the footer should be visible
    If grpArrayPage(Me.Page) = 1 Then
        Me.PageFooterSection.Visible = False
    Else
       Me.PageFooterSection.Visible = True
    End If
    
End Sub

Here's what has me puzzled. I have identical code for the Page Header - and it works. In addition, when I put in a break point and debug the code line by line, vb is identifying grpArrayPage(me.page) = 2 and performing the else code...except that the footer is not visible on page 2.

Any ideas on what may cause this to occur are welcome. Also, if perhaps there is a better way to assign group numbers to pages, I can try another method and perhaps that would get the footer to show.

Thanks in advance for the help!
 
So the Page header works and you want it to be the footer to be the same visibility?

How about something like...

Code:
Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)
     Me.PageFooterSection.Visible = Me.PageHeaderSection.Visible
End Sub

I never used the named references for page headers and footers so I am guessing at the section name but you get the idea.
 
lameid,

I liked your idea; unfortunately, the page footer is still not showing up on page 2. Again, I am confused as to why the code does not work because when taken through the debugger it appears that it should be working as intended.

Thanks for the idea...I'll be sure to post if I figure out a solution.

kellbell
 
I think it is coming back to me now (I had a similar type thing in a report).

Set the visibility of the page footer in the on format of the page header where your are setting whether the page header is visible or not.
 
That works!!! Thanks for all of your help! [thumbsup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top