"name not declared" but it is

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
 
H

Hermit Dave

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
 
V

vMike

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"),",")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top