Group Running Sum in Textbox

I just put the textbox in the Detail section, and code in the Section_Detail_Format event.
Code:
Private Sub Section_Detail_Format(Cancel As Integer, FormatCount As Integer)
    If Me.txtRunSum = 1 Then
        Me.Section_PageHeader.Visible = False
    Else
        Me.Section_PageHeader.Visible = True
    End If
End Sub
The trouble is that it doesn't seem to do anything, the page header is always visible.
 
I just had a thought and actually it's more than that. Upload an English version of your db and I'll take a look.
 
Thank you. I'll get right to it.
 
Page header code for making it visible or not has to go in the on format of the page header. It can't be in the other sections.
 
So in the Page Header section of your form, put this:
Code:
Me.Section_PageHeader.Visible = (Me.txtRunSum <> 1)
 
It still won't show the header on the second page. (The first page is the group header, the second one is the beginning of the actual report).
 
Remove all the code you have on your report and put just that code. I've tried it on the report you sent and it's working as expected.
 
Removed all code but that line, no difference.

Could it be a problem with my machine?
 
I don't understand why it worked by you. Could it be that since the first page consists only of the group header the second page of the report is actually regarded as the first?
 
Check the other pages and see if it works there. If it does, you just need to tweak the code slightly using IF and ELSEIFs.
 
Yes it does, the only problem is with the second page of each group (the group header spans over a whole page).
 
Like I said before, tweak the code and see what you can come up with.
 
No matter what I try either the page header is visible on all pages, or isn't visible on the first two pages.
 
Why not think about it. What do you use to determine which page is the first and/or second pages? You use the "[Page] of [Pages]" textbox. So what you do is if the Page is <= 2 then make sure it's visible, otherwise run the code I gave you.
 
The "[Page] of [Pages]" textbox is overall for all groups, I use a different method to determine the page per group (you'll see it in the report), but using that doesn't work either.
 
The first page of each group should contain only the group header, if I use the "[Page] of [Pages]" to determine when the page header is displayed, the second group and on will have the page header on their first page (instead of only the group header).

This is the code I tried:
Code:
Private Sub Section_PageHeader_Format(Cancel As Integer, FormatCount As Integer)

    If Page >= 2 Then
        Me.Section_PageHeader.Visible = True
    ElseIf Page < 2 Then
        Me.Section_PageHeader.Visible = (Me.txtRunSum <> 1)
    ElseIf GrpPage = 1 Then ' grpPage  is the variable that holds the current page number of the group
        Me.Section_PageHeader.Visible = False
    End If
    
End Sub

I tried it both with and without the last ElseIf.
 
Last edited:
Alright moishy, based on what I described in post #36 you almost got it but did the opposite. But don't despair ;) here's what you should have written:
Code:
 Private Sub Section_PageHeader_Format(Cancel As Integer, FormatCount As Integer)
 
     If Page <= 2 Then
         Me.Section_PageHeader.Visible = True
     Else Then
         Me.Section_PageHeader.Visible = (Me.txtRunSum <> 1)
     End If
     
 End Sub
... and remember to still comment out all the other code you have.
 

Users who are viewing this thread

Back
Top Bottom