Link to home
Start Free TrialLog in
Avatar of thayduck
thayduckFlag for United States of America

asked on

SSRS 2008 Report Code Not Working

Below Report code not working. Found it on the internet.
I am trying to find if my report is on page 1 or not so I can control the printing of a line thru-out report.

Public Shared Function PageOn (ByVal PageNumber() as string) as string
Dim str as string
If Globals!PageNumber = 1 then str = "False"
Else str = "True"
End If
Return str
End Function

In report and  using for line visibility:
=iif(code.PageOn = False,False,True)

Error:
Reference to a non-shared member requires an object reference.

If there is a better way to write this code and it works, I'm in...
ASKER CERTIFIED SOLUTION
Avatar of Vikas Garg
Vikas Garg
Flag of India 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
Avatar of thayduck

ASKER

Getting attached error when executing report.

Visibilty Line code I am using this Report Custom Code on:

=IIF(code.PageOn = "False", False,True)
PageOnError.PNG
Below Custom Code works, but , =IIF(code.PageNumber() = 1, False,True)  always shows False no matter what page report is on.  code.PageNumber() is always 1.

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