?
Solved

How make page footer shrink vertically after page 1

Posted on 2016-10-05
12
Medium Priority
?
46 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 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
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Suggested Courses

770 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