Access 2003 - report footer on first page only

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
     Me.PageFooterSection.Visible = False
   End If
end sub

any ideas?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Helen FeddemaCommented:
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.
Put the code in the page header or Detail event - by the tme you get to the page footer it's already too late.
Hamed NasrRetired IT ProfessionalCommented:
Try this:

If Page = 1 Then
      Me.PageFooterSection.Visible = True
     Me.PageFooterSection.Visible = False
End If
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

Jeffrey CoachmanMIS LiasonCommented:
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
ElseIf Me.Page > 1 Then
    Me.txt1.Visible = False
    Me.txt2.Visible = False
End If
End sub

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
        end if
    next ctl
end if

Hamed NasrRetired IT ProfessionalCommented:
Where to put code?
In format event of the object. Event is fired before formatting the section.
Hamed NasrRetired IT ProfessionalCommented:
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"
Jeffrey CoachmanMIS LiasonCommented:
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...


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.