Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show page footer on last page only 1

Status
Not open for further replies.

NSNewey

Programmer
Jun 29, 2005
125
GB
Hi,

I need to show some information at the very bottom of the last page on a report...

If you want something on a report to appear at the bottom of the page you have to use the page footer because using the report footer just places it at the end of the last detail on the report which could be half way up the page.

Now... If you want this page footer to print on the last page only, you can use the following code...
Code:
Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)
   If Me.Page = Me.Pages Then
        [green]'hide all the controls here[/green]
        Me.txtBox.Visible = False
        [green]'etc etc[/green]
   End If
End Sub

This works fine when in print preview but when I print the report it the page footer is on every page.

I have copied the code into the PageFooterSection_Print section but it still prints on every page.

Does anyone know how to make this work.

Thanks in advance,

Neil.
 

update...

sorry, forgot to mention that this only happens when I open the report in preview and print from there. When I open the report straight to print it works fine.

Any ideas???
 
try
Code:
Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)
Me.txtBox.Visible =(Me.Page = Me.Pages)
end if
 
pwise:- It's just a slightly more efficient way of coding the same thing but it doesn't effect the problem. Thanks though.

dhookom:- Yes there are bound textboxes on the footer.
 
NSNewey:

Have you tried this? This is more then just a slightly more efficient way it makes the text box Visible if it is the last page not Visible if it is not the last page

 
Hi pwise.
Yes, I take your point but I forgot to mention that the cotrols are set to not visible to start with so I only need set them visible on the last page.
 
pwise....

I bow in homage to you.

No I didn’t try it, I arrogantly assumed that it was the same as I was doing and have to shamefully admit to getting slightly mived at the fact that the thread reply count was going up which makes it less likely that others will view the thread to reply.

I have now tried it and, as I’m sure you know, it does work.

Excellent. Thanks. Lesson learned.

Neil.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top