Link to home
Start Free TrialLog in
Avatar of Victor  Charles
Victor CharlesFlag for United States of America

asked on

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
Avatar of sammySeltzer
sammySeltzer
Flag of United States of America image

="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

Avatar of Victor  Charles

ASKER

Thanks. After I drag the textbox to the footer section where do´I enter  

="Page " & Globals!PageNumber & " of " & Globals!TotalPages.ToString?
Just create a textbox like you have done, right-click on it, click expressions and there.
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?
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.
'I tried both, will try your last suggestion and get back to you later. Thanks.
ASKER CERTIFIED SOLUTION
Avatar of sammySeltzer
sammySeltzer
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It worked. Thanks.