Solved

How make page footer shrink vertically after page 1

Posted on 2016-10-05
12
36 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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
 

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
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.
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…

777 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