"name not declared" but it is

  • Thread starter Thread starter TJS
  • Start date Start date
T

TJS

it says the name is not declared, but it is
how can I fix this ?

Compiler Error Message: BC30451: Name 'arrReportsList' is not declared.


==========================
if Len(request.querystring("rpt")) > 0 then
Dim arrReportsList =split(request.querystring("rpt"),",")
else
Dim arrReportsList =split(Session("rpt"),",")
end if

vPagecount = Ubound(arrReportsList) + 1 '<== error on this line
 
the reason is that you are defining a variable local to that block
ie the variable arrReportList is local to your if or else block

try something like this
Dim arrReportList (not sure how you do it in VB but in c# you would do it
this way string[] arrReportList
if Len(request.querystring("rpt")) > 0 then
arrReportsList =split(request.querystring("rpt"),",")
else
Dim arrReportsList =split(Session("rpt"),",")
end if

vPagecount = Ubound(arrReportsList) + 1 '<== error on this line

Should be fine now... hth
 
You have to declare the type.

Dim arrReportsList as string()

I would declare it before the if statement and then set it in the if
statement

arrReportsList = split(request.querystring("rpt"),",")
 
Back
Top