Solved

How make page footer shrink vertically after page 1

Posted on 2016-10-05
12
42 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 22

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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
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 500 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

717 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