?
Solved

Access 2003 - report footer on first page only

Posted on 2012-03-26
7
Medium Priority
?
625 Views
Last Modified: 2012-03-26
I am using this code to show the footer only on the first page of a report. It is not working. It show none. I am putting in the on format and onprint?

Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)
If Me.Page = 1 Then
 
  Me.PageFooterSection.Visible = True
    Else
     Me.PageFooterSection.Visible = False
   End If
end sub


any ideas?
0
Comment
Question by:Pdeters
[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
7 Comments
 
LVL 31

Expert Comment

by:Helen Feddema
ID: 37766224
This works for a simple footer (just a text box), though of course you could use the same technique for several textboxes:

This is the control source of the textbox:  =IIf([Page]=1,"Page " & [Page] & " of " & [Pages],"")

Make sure that you have the Page Footer set for All Pages in the Report property sheet.
0
 
LVL 77

Expert Comment

by:peter57r
ID: 37766231
Put the code in the page header or Detail event - by the tme you get to the page footer it's already too late.
0
 
LVL 30

Expert Comment

by:hnasr
ID: 37766241
Try this:

If Page = 1 Then
      Me.PageFooterSection.Visible = True
Else
     Me.PageFooterSection.Visible = False
End If
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 74

Expert Comment

by:Jeffrey Coachman
ID: 37766380
Or you can just hide the "Controls" in the footer, with basically the same event:

Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)
If Me.Page = 1 Then
    Me.txt1.Visible = True
    Me.txt2.Visible = True
    Me.lbl45.visible=True
ElseIf Me.Page > 1 Then
    Me.txt1.Visible = False
    Me.txt2.Visible = False
    Me.lbl45.Visible=False
End If
End sub

Note:
If you have a lot of control in the page footer, you can give them all the same "Tag" (ex. "PgFtr") property and loop through them with something like this:

Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)
Dim ctl as control
If me.Page=1 then
    For each ctl in me.controls '(or narrow it to the page footer)
        If ctl.Tag="PgFtr" then
            ctl.visible=True
        else
            ctl.visible=False
        end if
    next ctl
end if


JeffCoachman
0
 
LVL 30

Expert Comment

by:hnasr
ID: 37766637
Where to put code?
In format event of the object. Event is fired before formatting the section.
0
 
LVL 30

Expert Comment

by:hnasr
ID: 37766661
If you click on Format event in the event tab of PageFooterSection properties sheet , watch the status bar displaying, "Macro or function that runs before section is formatted"
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 2000 total points
ID: 37767904
Besides turning off the individual controls in the Page footer, here is what also worked for me:

Set the Section Visible property to Yes in the property sheet
Then do this on the "Page" event
    Me.PageFooterSection.Visible = False

The "Page" event fires each time you *change* the page.
So since opening the report for the first time (and displaying Page 1) is not technically "Changing" the page, this event does not fire.
Hence it only fires *after* page 1.
So doing this may also give the OP what they are seeking...

JeffCoachman
0

Featured Post

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Suggested Courses

765 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