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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hide page footer if no of printed Pages > 1 2

Status
Not open for further replies.

Pampers

Technical User
Apr 7, 2004
1,300
AN
Hi everyone,
I made a report that prints Bills Of Lading. Sometimes the number of containers on this documents exceeds 1 page, so the lists continues on the second page. But on this second page I don't want to see the page footer. I tried to use The PageFooter-property, but this can't handle the problem. Is there a way to solve this problem???

Pampers [afro]

you're never too young to learn
 
1) Go to your VBA code for the report
2) Add the following code:
Code:
Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)
    If Page >= Pages Then
        Cancel = -1
    EndIf
End Sub

Let me know how it goes. =]


-Pete
 
You can try like this...

Code:
Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)
    If Me.Page > 1 Then Cancel = True
End Sub

Place the above code in Report VBA
Event is PageFooterSection_Format

Hope this helps you...

Regards,
 
tnx a lot guys!! works perfect. Here is the code I put in:
Code:
'hides page footer section if the report has more than 1 page
Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)
    If Page > 1 Then
    MsgBox "This B/l has more then one page, please insert a blanc sheet into your stack", vbOK
    Cancel = -1
    End If
End Sub

Just one other thing. I used the msgbox to hint the user. But (s)he gets the message on the moment of actual printing. How can i hint the user already if (s)he generates the print preview?




Pampers [afro]

you're never too young to learn
 
When the user nagigates to second page of the report the msgbox should appear.

It does matter if the report is in acviewnormal mode or acviewpreview mode.

Regards.
 
Hi HandsOnAccess,
Tnx for the reply. Yes it does show the message if you navigate to the second page in the PrintPreview of the report.

But would it be possible to already show the message on the first page of the preview, since a second page is already generated? You see, users tend not to scroll to second page, because 99% of the Bills Of Lading consists of only one page.

Pampers [afro]

you're never too young to learn
 
Yes it is possible to show the message in the first itself

In the report design view place a TextBox.
Set the Visible Property of the TextBox to False.
Set the Name Property of the TextBox as TotalPages.
In the Control Source Property of the TextBox Type =Pages

Further, Here is how you need to code...

Code:
Private Sub Report_Page()
    If Me.Page = 1 And Me.TotalPages > 1 Then MsgBox "Please Insert Extra Sheet"
End Sub

Save and Preview the Report...

Regards,
 
Excellent HandsOnAccess. Tnx a lot.


Pampers [afro]

you're never too young to learn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top