Hide Page Footer except last page (1 Viewer)

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 21:18
Joined
Sep 12, 2006
Messages
15,696
i put it in the page HEADER format event
 

Ziggy1

Registered User.
Local time
Today, 21:18
Joined
Feb 6, 2002
Messages
462
i put it in the page HEADER format event
Me.Section("PageFooter").Visible = [Page] = [Pages]


you are awesome thanks for figuring it out, I was getting ready to look at the report footer again and code the controls to specific positions at the bottom of the page.

Thanks also to Simon, and everyone else
 

Ziggy1

Registered User.
Local time
Today, 21:18
Joined
Feb 6, 2002
Messages
462
oh no, not quite there, if the report footer has enough room to first on the first page, it seems to not set the visible to true, and I can see that the page numbers show 1 of 2. It seems that because the data formating is complete the current page counter does not move to match the "pages" count? so it is not able to unhide.
 

stopher

AWF VIP
Local time
Today, 21:18
Joined
Feb 1, 2006
Messages
2,395
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
 

Ziggy1

Registered User.
Local time
Today, 21:18
Joined
Feb 6, 2002
Messages
462
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 know what you are saying, but not quite clear on how i will "Trap"it, when I have been debugging the code and stepping through the lines, I can see the Page counter is showing 1 of 2 (in variable), then the event seems to end in the "PageHeader_Format" event and previews the report...then when I click the next Page it jumps back "PageHeader_Format" event at which point the Pages are equal but it seems to late to display the footer at that point.

I set break points on every event,

I am open to resizing the controls as well, but seem to be having trouble with that as well.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 21:18
Joined
Sep 12, 2006
Messages
15,696
you have to set the pagefooter visible to FALSE in the porperty settings, to avoid the issue stopher highlighted.

i think access prereads the report ANYWAY thought, as page and pages are just properties of the report object.

when i was playing with it, i saw that problem, because having on page footer gives a different page count to having a page footer. but i didnt get any problems after i made the footer visible.

i would think therefore you could GUARANTEE no problems with just

Me.Section("PageFooter").Visible = [Page] >= [Pages]
 

stopher

AWF VIP
Local time
Today, 21:18
Joined
Feb 1, 2006
Messages
2,395
If you don't get any luck will Gemma's idea then I've attached your database making the changes I proposed. It doesn't use the page numbers at all. Instead it sets the page footer to visible once at the end of the last "group" of data.

Take a look at your report 7 again - specifically the code. Works fine for me but I haven't tested with any data than is already there.

hth
Chris

PS. I'm using Access 2007 so you may have to apply the syntax that Gemma mantioned earlier.
 

Attachments

  • SAMPLePicklistfileBOL2.zip
    81.3 KB · Views: 149

Ziggy1

Registered User.
Local time
Today, 21:18
Joined
Feb 6, 2002
Messages
462
I am getting some success with both methods..the Page count matches ...but if you reduce the records in the "tblPickListDtl_App" table to 27 and run it it won't display the footer.
 

Brianwarnock

Retired
Local time
Today, 21:18
Joined
Jun 2, 2003
Messages
12,701
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
 

Ziggy1

Registered User.
Local time
Today, 21:18
Joined
Feb 6, 2002
Messages
462
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

you might want to put the link to the post as it won't always stay prior to mine...but I have tried all that, it is not consistant with varying page counts...you have to read the previous posts
 

stopher

AWF VIP
Local time
Today, 21:18
Joined
Feb 1, 2006
Messages
2,395
Did you have any luck with my solution Ziggy?:

Code:
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

Chris
 

Ziggy1

Registered User.
Local time
Today, 21:18
Joined
Feb 6, 2002
Messages
462
Hi Stopher,

it won't show the footer when there is only one page of data. but you have "Report_Load" I just noticed, is that because you have 2007? I guess for me it would be report Open...I'll try that
 

Ziggy1

Registered User.
Local time
Today, 21:18
Joined
Feb 6, 2002
Messages
462
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
 

Ziggy1

Registered User.
Local time
Today, 21:18
Joined
Feb 6, 2002
Messages
462
no matter what I do I am not able to figure out what combination will catch when it is a single page and when multiple pages, every time I try something it is like a toggle just can't get it right.
 

stopher

AWF VIP
Local time
Today, 21:18
Joined
Feb 1, 2006
Messages
2,395
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
I'm guessing you might need to use Gemma's suggested syntax which you said worked (at least in terms of making it visible:
Code:
Me.Section("PageFooter").Visible = true

If all else fails I'll load up Acess'97 on an old pc (my wife will never notice:D) and maybe we can work on your latest d/b

Chris
 

Brianwarnock

Retired
Local time
Today, 21:18
Joined
Jun 2, 2003
Messages
12,701
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
 

Ziggy1

Registered User.
Local time
Today, 21:18
Joined
Feb 6, 2002
Messages
462
guess were going in Circles, Gemma's didn't work 100% either for the same reason. Anyways thanks for trying, I don't want to take up all of your time trying to figure it out. I'm spending too much as it is, for now I am going with my initial setup that just hid the controls....my brain has gone to Mush trying to figure it out and I know that is clouding my thinking :eek:

I see Brian just posted a link, I will look at that over the weekend...thanks.
 

stopher

AWF VIP
Local time
Today, 21:18
Joined
Feb 1, 2006
Messages
2,395
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

Of course!

We've been trying to get the footer to disappear but if we leave the footer fixed and just make the text boxes invisible then the report length is always constant so "pages" is accurate.

Although I think making the page footer disappear is more elegant :p
 

Brianwarnock

Retired
Local time
Today, 21:18
Joined
Jun 2, 2003
Messages
12,701
I agree but when I tried it I ran into all of the problems the poster has. What would be really nice is for Access to allow us to selectively have one, but thats unlikely to happen,
Ziggy's footer is quite large which will make the pages it is not on look a little odd.

Brian
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 21:18
Joined
Sep 12, 2006
Messages
15,696
i still dont understand

accesses stock reports use the expression

="page " & [page] & " of " & [pages]

so you must be able to use these values.

------------
so the key is to have the pagefooter not visible normally. but make it visible on the last page. The only thing that i thought could happen with this, is that a 9 page report becomes 10 pages, because showing the footer on the "last" page, pushes the detail onto another page 10.

I couldnt replicate this - or at least i couldnt get a situation where I didnt see the final footer. So i'm not convinced that access cant resolve this on its own

As I said, i tested the page counts to make the footer visible in the page header - but perhaps you can do this test in the report footer, say
 

Users who are viewing this thread

Top Bottom