Solved

How make page footer shrink vertically after page 1

Posted on 2016-10-05
12
29 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 57
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
 
LVL 57
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 57

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:SteveL13
ID: 41830197
It is and I am.
0
 
LVL 57
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 57
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now