Forum Discussion
How to Retrieve Total Page number from the Sub Report
- 2 years ago
Go to Report > Report Properties > Code
Public Shared SubReportPageCount As Integer Public Function GetSubReportPageCount() As Integer Return SubReportPageCount End Function Public Sub SetSubReportPageCount(ByVal pageCount As Integer) SubReportPageCount = pageCount End SubIn your subreport, create a text box and set its value to the following expression
=Code.SetSubReportPageCount(Globals!OverallTotalPages)In the parent report, create a text box and set its value to the following expression
=Code.GetSubReportPageCount()or you could use a parameter, "SubReportTotalPages" in the subreport with a value of =Globals!OverallTotalPages and pass the parameter to the parent report by adding the same named parameter to the parent report and set the value to the subreport's parameter.
In the parent report you could then just reference the parameter
=Parameters!SubReportTotalPages.Value
Go to Report > Report Properties > Code
Public Shared SubReportPageCount As Integer
Public Function GetSubReportPageCount() As Integer
Return SubReportPageCount
End Function
Public Sub SetSubReportPageCount(ByVal pageCount As Integer)
SubReportPageCount = pageCount
End Sub
In your subreport, create a text box and set its value to the following expression
=Code.SetSubReportPageCount(Globals!OverallTotalPages)
In the parent report, create a text box and set its value to the following expression
=Code.GetSubReportPageCount()
or you could use a parameter, "SubReportTotalPages" in the subreport with a value of =Globals!OverallTotalPages and pass the parameter to the parent report by adding the same named parameter to the parent report and set the value to the subreport's parameter.
In the parent report you could then just reference the parameter
=Parameters!SubReportTotalPages.Value