Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 434
  • Last Modified:

Help with including page numbers in a report

Hello,

I am using MS Report with VS2008, the data is in table format. How do <i include page numbers at the page footer or table footer?

Victor
0
vcharles
Asked:
vcharles
  • 4
  • 4
1 Solution
 
sammySeltzerCommented:
="Page " & Globals!PageNumber & " of " & Globals!TotalPages.ToString

Open in new window


Or you can use functions:

Go to "Report" -> "Report Properties" -> "Code"

In the Custom Code section, enter the following:

Public Funtion PageNumber() as String
     Dim str as String
     str = Me.Report.Globals!PageNumber.ToString()
     Return str
End Function

Public Function TotalPages() as String
     Dim str as String
     str = Me.Report.Globals!TotalPages.ToString()
     Return str
End Function

Open in new window


To display the page number and total pages in a textbox located in the footer simply enter this for the value:

="Page " + Code.PageNumber() + " of " + Code.TotalPages()

Open in new window

0
 
vcharlesAuthor Commented:
Thanks. After I drag the textbox to the footer section where do´I enter  

="Page " & Globals!PageNumber & " of " & Globals!TotalPages.ToString?
0
 
sammySeltzerCommented:
Just create a textbox like you have done, right-click on it, click expressions and there.
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
vcharlesAuthor Commented:
I went to Report properties and inlcuded the code above but I got the following error message:

Error      2      There is an error on line 0 of custom code: [BC30205] End of statement expected.      

How do I fix this error?
0
 
sammySeltzerCommented:
which code are you using?

The custom code or the expression?

If the expression, the more appropriate location is right-click on your textbox, properties, there where it says repeat on every page.
0
 
vcharlesAuthor Commented:
'I tried both, will try your last suggestion and get back to you later. Thanks.
0
 
sammySeltzerCommented:
You have to ensure that your textbox is *below* the footer.

In other words, click Report at the top, Page Footer

Then drag a textbox anywhere on the report, right-click on it, on the Value, That's what I meant last time, on the Value box, enter the following:

="Page " + Globals!PageNumber.ToString() + " of " + Globals!TotalPages.ToString()

or the one from custom code.

Finally, drag the textbox just below your footer and it should work.
0
 
vcharlesAuthor Commented:
It worked. Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now