Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ReDim an Array HELP

16 views
Skip to first unread message

Aaron Hatfield

unread,
Sep 21, 2000, 3:00:00 AM9/21/00
to
I created a dynamic array seems to work but when I try and to redimension
the array at the end
I get

Microsoft VBScript runtime error '800a000a'

This array is fixed or temporarily locked


<%
'Enter Companies List for the user

DIM CompanyCount
DIM allstuff(200)

CompanyCount = 0

While Not RsCmp.Eof

CompanyCount = CompanyCount + 1


allstuff(CompanyCount) = RsCmp("CMP_ID")

Response.Write "<option value =" & RsCmp("CMP_ID") & ">" &
RsCmp("CMP_NAME") & _
"</option>"


RsCMP.MoveNext
WEnd

RsCmp.Close
Set RsCmp=Nothing

ReDim allstuff(CompanyCount)

%>

Tom Lavedas

unread,
Sep 21, 2000, 3:00:00 AM9/21/00
to
Aaron Hatfield wrote:
>
> I created a dynamic array seems to work but when I try and to redimension
> the array at the end
> I get
>
> Microsoft VBScript runtime error '800a000a'
>
> This array is fixed or temporarily locked
>
> <%
> 'Enter Companies List for the user
>
> DIM CompanyCount
This line fixes the dimension ...
> DIM allstuff(200)

Use this instead ...

ReDim allstuff(200)



> CompanyCount = 0
>
> While Not RsCmp.Eof
>
> CompanyCount = CompanyCount + 1
>
> allstuff(CompanyCount) = RsCmp("CMP_ID")
>
> Response.Write "<option value =" & RsCmp("CMP_ID") & ">" &
> RsCmp("CMP_NAME") & _
> "</option>"
>
> RsCMP.MoveNext
> WEnd
>
> RsCmp.Close
> Set RsCmp=Nothing

And if you want the data, you will need to use the Preserve keyword ...

ReDim Preserve allstuff(CompanyCount)

> %>

Also, what happens if there are 201 companies?

Tom Lavedas
-----------
http://www.pressroom.com/~tglbatch/

Aaron Hatfield

unread,
Sep 21, 2000, 3:00:00 AM9/21/00
to

Now the error is gone but the array = "" ReDim Preserve
allstuff(CompanyCount)


"Tom Lavedas" <lav...@pressroom.com> wrote in message
news:39CA56E...@pressroom.com...

Tom Lavedas

unread,
Sep 21, 2000, 3:00:00 AM9/21/00
to
And what is the value of CompanyCount? Sounds to me like the While loop
is not being exercised.

0 new messages