Solved

Help with including page numbers in a report

Posted on 2012-03-30
9
420 Views
Last Modified: 2012-03-31
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
Comment
Question by:vcharles
  • 4
  • 4
9 Comments
 
LVL 28

Expert Comment

by:sammySeltzer
ID: 37787884
="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
 

Author Comment

by:vcharles
ID: 37788017
Thanks. After I drag the textbox to the footer section where do´I enter  

="Page " & Globals!PageNumber & " of " & Globals!TotalPages.ToString?
0
 
LVL 28

Expert Comment

by:sammySeltzer
ID: 37788056
Just create a textbox like you have done, right-click on it, click expressions and there.
0
 

Author Comment

by:vcharles
ID: 37788065
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 28

Expert Comment

by:sammySeltzer
ID: 37788077
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
 

Author Comment

by:vcharles
ID: 37788113
'I tried both, will try your last suggestion and get back to you later. Thanks.
0
 
LVL 28

Accepted Solution

by:
sammySeltzer earned 500 total points
ID: 37788141
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
 

Author Comment

by:vcharles
ID: 37791245
It worked. Thanks.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Hi, In my previous Article  (http://www.experts-exchange.com/Database/Reporting/A_15199-Introduction-to-Microstrategy.html)I discussed some basic understanding of Microstrategy that how we can get in Intro of Microstrategy (MSTR). Now it's tim…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now