PDA

View Full Version : Subscript out of range: '2'


janevok
06-09-2003, 03:57 PM
Hi,

For the first time im using arrays and setting their size automatically. I am encountering this error (Subscript out of range: '2') and ive no idea why!

Here is the code that produces this error:-

dim navbarSectionsTitleArray2()
redim navbarSectionsTitleArray2(1)
dim rows2
rows2 = uBound(navbarSectionsTitleArray2)

'assign values to the array

redim preserve navbarSectionsTitleArray2(rows + 1)

Im wondering if it could have anything to do with the values i am assigning to the array? It is just text.

I know this is not much info, but if anyone can give me an idea of why this error occurs that should give me a start on solving this problem.

any advice/help much appreciated

Laura

arnyinc
06-09-2003, 05:22 PM
I ran this code and didn't receive any errors. Not sure where your problem is.

<HTML>
<HEAD>
</HEAD>

<BODY>

<%
dim navbarSectionsTitleArray2()
redim navbarSectionsTitleArray2(1)
dim rows2
rows2 = uBound(navbarSectionsTitleArray2)

'assign values to the array

redim preserve navbarSectionsTitleArray2(rows + 1)
%>

</BODY>
</HTML>

janevok
06-09-2003, 06:08 PM
i was a bit stupid, when inserting values into the array i was using a seperate counter and not the counter i initiated (rows) - only took me an hour or so to work that out ;)

thanks for trying it out though...really appreciate it!
:)