I have a report in which I need to total a column with an expression and created simple code to have a running total. When I run the report through report builder, the total only reflects the current page (it is 6 pages long) but if I export the report out to Excel, the total is correct.
Below is the code:
Public running_roy as Double = 0
Public Function roy_tot(ByVal cust_type, ByVal roy, ByVal ret_value) as Double
Dim temp_var as Double
if cust_type = 0 then
running_roy = running_roy + roy
if ret_value = 0 then
temp_var = roy
else
temp_var = running_roy
end if
ELSE
temp_var = 0
end if
return temp_var
End Function
If I change the Public variable to "Public Shared" the totals change as I flip back and forth between the pages in report builder.
Any suggestions?