Ash Skilton
New member
- Local time
- Today, 04:59
- Joined
- Apr 17, 2013
- Messages
- 7
Hi,
I'm fairly new to Access and VBA. I have a slight problem with printing a report that i'm hoping someone can advise me with.
The report can have one or multiple pages and the Page Footer only appears on the last page.
To achieve this I have used the VBA code:
This tells it to only show Page Footer if the current page is equal to the total pages putting it on the last page only.
This works but my problem is it calculates the total pages before it does the formatting.
So for example the report with the Page Footer on each page may take up 3 pages but once the Page Footer is removed from the first 2 pages it reduces the total pages needed from 3 to 2.
So when I print the report it only prints 2 pages but shows as 1 of 3 and 2 of 3 and the Footer does not print on page 2 because it thinks there is a 3rd page that it should be printing on that no longer exists.
So my question is there a way for it to re-calculate how many pages there are after my formatting has occurred before I print so it knows how many pages there are once the footer has been removed from everything but the last?
Using Report Footer is not an option because I need the footer to be at the absolute bottom of the last page and with Report Footer it can appear half way up the page if that is where the Report Details finish.
Access Version: 2010 Professional.
I'm fairly new to Access and VBA. I have a slight problem with printing a report that i'm hoping someone can advise me with.
The report can have one or multiple pages and the Page Footer only appears on the last page.
To achieve this I have used the VBA code:
Code:
Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)
If [Page] = [Pages] Then
Me.PageFooterSection.Visible = True
Else
Me.PageFooterSection.Visible = False
End If
End Sub
This tells it to only show Page Footer if the current page is equal to the total pages putting it on the last page only.
This works but my problem is it calculates the total pages before it does the formatting.
So for example the report with the Page Footer on each page may take up 3 pages but once the Page Footer is removed from the first 2 pages it reduces the total pages needed from 3 to 2.
So when I print the report it only prints 2 pages but shows as 1 of 3 and 2 of 3 and the Footer does not print on page 2 because it thinks there is a 3rd page that it should be printing on that no longer exists.
So my question is there a way for it to re-calculate how many pages there are after my formatting has occurred before I print so it knows how many pages there are once the footer has been removed from everything but the last?
Using Report Footer is not an option because I need the footer to be at the absolute bottom of the last page and with Report Footer it can appear half way up the page if that is where the Report Details finish.
Access Version: 2010 Professional.
Last edited: