Pdeters
asked on
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(C ancel As Integer, FormatCount As Integer)
If Me.Page = 1 Then
Me.PageFooterSection.Visib le = True
Else
Me.PageFooterSection.Visib le = False
End If
end sub
any ideas?
Private Sub PageFooterSection_Format(C
If Me.Page = 1 Then
Me.PageFooterSection.Visib
Else
Me.PageFooterSection.Visib
End If
end sub
any ideas?
Put the code in the page header or Detail event - by the tme you get to the page footer it's already too late.
Try this:
If Page = 1 Then
Me.PageFooterSection.Visib le = True
Else
Me.PageFooterSection.Visib le = False
End If
If Page = 1 Then
Me.PageFooterSection.Visib
Else
Me.PageFooterSection.Visib
End If
Or you can just hide the "Controls" in the footer, with basically the same event:
Private Sub PageFooterSection_Format(C ancel 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(C ancel 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
Private Sub PageFooterSection_Format(C
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(C
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
Where to put code?
In format event of the object. Event is fired before formatting the section.
In format event of the object. Event is fired before formatting the section.
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"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.