SPecial Heading on Last Page

  • Thread starter Thread starter Guest
  • Start date Start date
I Have a report but want a special heading on the last page. How can I accomplish this.

In the Report's Page Header, add whatever controls you need on the
last page, as well as the controls wanted on the other pages.

For the controls wanted only on that last page, set their Visible
Property to No.

Add a control to the Page Footer to compute [Pages].
Something like
=[Page] & " of " & [Pages]
will be fine if you wish to show it, or simply
= [Pages]
and set it's Visible property to No if you do not wish to show it.

Then code the Page Header Format event:

If [Page] = [Pages] Then
Dim c as Control
For each c in Me.Section(3).Controls
c.Visible = not c.Visible
Next
End If

Those controls which you wanted to show just on the last page will
then show, while all the others wont.

If there are some control's you wish to show on all the pages, use:
If [Page] = [Pages] Then
Dim c as Control
For each c in Me.Section(3).Controls
If c.Name = "SomeControl" or c.Name = "SomeOtherControl" Then
Else
c.Visible = Not c.Visible
Next
End If

The 2 named controls will not be changed.
 
On Mon, 19 Jan 2004 11:52:04 -0800, "George Schneider"


See my reply interspersed below...
I tried out your suggestions and run into a couple of problems.
The example on showing the heading on just the last page
works if you run the report, but if you scroll to the lasat page
and then scroll back to the first page all the headings that are
suppose to appear on every page except for the last are missing
and the heading that is suppose to appear on the last page
appears as the heading.

That's because once you display that last page, the controls have
had their visible property changed and they have not been turned back
to their previous state.

How many controls are you using just in the final page header?
If it's just a few, use code like this, in the Page Header Format
event, naming the controls to be changed.

If [Page] = [Pages] Then
' Last page
Text39.Visible = True 'Show on last page
Label37.Visible = True 'Show on last page
Text3.Visible = False ' Do NOT show on last page
Text4.Visible = False ' Do NOT show on last page
Else
' Other pages
Text39.Visible = False ' Do NOT show on other pages
Label37.Visible = False ' Do NOT show on other pages
Text3.Visible = True ' Show on other pages
Text4.Visible = True ' Show on other pages
End If

Controls which are to appear on all the pages can be left
with their visible property set to Yes.
The example of controls that are suppose to appear on every page
given an compile error next with for.

New example doesn't use a For .. Next loop.
Also the named control would be the textboxt name text39 or label37 correct.
Yes that is correct.
See my new example above.
 
Back
Top