?
Solved

How make page footer shrink vertically after page 1

Posted on 2016-10-05
12
Medium Priority
?
52 Views
Last Modified: 2016-10-20
I have a report that contains a page footer.  I only want the page footer to appear on page 1.  So I have this code in the onprint event of the report which works fine.

Private Sub PageFooterSection_Print(Cancel As Integer, PrintCount As Integer)

    If Me.txtPageCounter > 1 Then
        Me.PageFooterSection.Visible = False
    End If

End Sub

Open in new window


But after page 1 I want the detail section of the report to print all the way to the bottom of the page.  I tried this in the onformat event of the page footer but it doesn't work.  The detail stops vertically where the page footer would start if it was appearing.

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

    If Me.txtPageCounter > 1 Then
        Me.PageFooterSection.Height = 0
    End If

End Sub

Open in new window


How can I make the detail section go to the bottom of the page after page 1?
0
Comment
Question by:SteveL13
  • 6
  • 5
12 Comments
 
LVL 58
ID: 41830123
In the OnFormat of the page header, I would do:

    If Me.txtPageCounter = 1 Then
        Me.PageFooterSection.Visible = True
    Else
        Me.PageFooterSection.Visible = False
    End If
0
 

Author Comment

by:SteveL13
ID: 41830152
When I copy/paste your suggested code in the page header onformat event it all turns red and I get a syntax error on the 1st line.

So then I thought that perhaps I needed a txtPageCounter field in the header also but that didn't work.
0
 
LVL 23

Expert Comment

by:Ferruccio Accalai
ID: 41830164
I'd do that in Detail_Format
Private detailHeight As Integer     ' The height of your detail section
Private footerHeight As Integer     ' The height of your footer section

Private Sub Report_Open(Cancel As Integer)
    detailHeight = Me.Detail.Height
    footerHeight = Me.PageFooterSection.Height
End Sub

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
   If Me.txtPageCounter > 1 Then
        Me.Detail.Height = detailHeight+footerHeight
        Me.PageFooterSection.Height = 0
    End If
End Sub

Open in new window

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 58
ID: 41830168
Change to:

    If Me.Page = 1 Then
        Me.PageFooterSection.Visible = True
    Else
        Me.PageFooterSection.Visible = False
    End If

Jim.
0
 

Author Comment

by:SteveL13
ID: 41830184
Jim,

I tried that and now the page footer doesn't appear at all.

Also, strange thing... I copy/pasted your latest suggestion and it all turned red again.  So I re-typed your suggestion and it did not turn red.
0
 
LVL 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 2000 total points
ID: 41830192
Make sure it's height is not zero and that your doing this in the Page header.   If that doesn't work, then I'll have to try it here.

Jim.
0
 

Author Comment

by:SteveL13
ID: 41830197
It is and I am.
0
 
LVL 58
ID: 41831480
Steve,

  Sorry for the delay in getting back to you.   I checked this out here and that works fine.

There are two things that may be tripping you up:

1. The name of your page footer.   Open the report in design view, open the property sheet, and click on the page footer.   Now look at it's name.   It may be called "PageFooter4" for example.

2. If your manipulating the page number.   Often, logic in a report will reset the page number.   If you do this, you need to take this into account.

 But the technique of hiding the page footer does indeed allow the detail to drop all the way to the bottom.

 If you still have problems with this, then posting a sample would help.  

Jim.
0
 

Author Comment

by:SteveL13
ID: 41837586
Jim,  Sorry I'v e been out of town for a few days.  I will try to get a sample d/b put together for you tomorrow.
0
 

Author Comment

by:SteveL13
ID: 41845057
Jim,

Sorry again... I've been jammed but will try to get to this early next week.
0
 
LVL 58
ID: 41846506
No problem.

Jim.
0
 

Author Closing Comment

by:SteveL13
ID: 41852572
I was wrong.  I was NOT doing this in the page header.  Your suggestion ended up working.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question