- Local time
- Today, 16:26
- Joined
- Sep 12, 2006
- Messages
- 15,695
i put it in the page HEADER format event
i put it in the page HEADER format event
Me.Section("PageFooter").Visible = [Page] = [Pages]
This is the problem with using the page = pages method as far as I can see it. You are using pages and therefore this forces the report to run twice. The first run is used to find out the value for pages and the second run is to actually produce the report. This is fine. However, on the first run the footers are all visible whereas on the second run only the last footer is visible. Thus the final report is much shorter then calculated (than "pages"). So there is easily the potential for the last page never to be reached.
Here’s my solution (actually based on someones solution for special page numbering). The principle is to find out the “name” last group to be printed then use this as the point to switch the footer to visible ….
Have a flag that is used to identify if the report is on the first or second run.
When the flag is “first”, then find the last most major group i.e. as the report runs, store the value of the major group. So at the end of the first run, the value will be the last major group in the report.
Also at the end of the first run, make sure the flag is then set to second (this could be done in the report header for instance run=run+1).
In the group footer for our major group, if we are on the second run and we are in the last group, then set page footer to visible. Else if second run and not last group then set page footer to invisible.
Hope that makes sense. Sorry no code but have no time. Maybe later.
Chris
I thought why not just put what you want in the page footer and only make it visible when me.page=me.pages, and guess what, that is precisely what the thread just prior to yours in reports is doing.
Brian
Dim intCycle As Integer 'the report run counter
Dim strLastGroup As String 'saves the name of the final group
Private Sub Report_Load()
'belts and braces
intCycle = 0
Me.PageFooter1.Visible = False
End Sub
Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)
'increment the counter each time the report runs (note it only runs twice)
intCycle = intCycle + 1
End Sub
Private Sub GroupFooter0_Format(Cancel As Integer, FormatCount As Integer)
If intCycle = 1 Then
'this is where we find out the name of the last group during the first run
strLastGroup = Me.ord_dtl004
ElseIf intCycle = 2 And strLastGroup = Me.ord_dtl004 Then
'if we're on the second run and on the last group the make pagefooter visible
Me.PageFooter1.Visible = True
End If
End Sub
Private Sub GroupFooter0_Format(Cancel As Integer, FormatCount As Integer)
If intCycle = 1 Then
strLastGroup = Me.ord_dtl004
ElseIf intCycle = 2 And strLastGroup = Me.ord_dtl004 Then
[B] Me.PageFooter1.Visible = True[/B]
End If
I'm guessing you might need to use Gemma's suggested syntax which you said worked (at least in terms of making it visible:what I don't understand is, I put a breakpoint ( the bolded line) and it sets it to TRUE, but doesn't show it? * before that it is false, so not sure if it is too late at that point, I am trying different sections to see
Code:Private Sub GroupFooter0_Format(Cancel As Integer, FormatCount As Integer) If intCycle = 1 Then strLastGroup = Me.ord_dtl004 ElseIf intCycle = 2 And strLastGroup = Me.ord_dtl004 Then [B] Me.PageFooter1.Visible = True[/B] End If
Me.Section("PageFooter").Visible = true
This is the Link, I searched on pagefooter, a wonderful facility.
To get it to work perfectly I had to make his hidden report footer a minimum height and also close the top of the page footer to the bottom of the detail fields otherwise you can get a blank page with the footer only showing.
Brian