Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling dynamic Array elements 1

Status
Not open for further replies.

Ferrian

Programmer
Sep 7, 2005
53
GB
I have already had a quick search through the FAQs, but couldn't find anything on this subject and my code keeps giving me errors, so if anyone could help...

Basically I am trying to create an array and then call specific elements from the array to use in an SQL statement.

x=0
dim SplitArray()

'SQL statement calling several con_id

while not rs.eof

redim SplitArray(x)
SplitArray(x) = rs("con_id")

response.write(x &": "& SplitArray(x) &"<br />")

x = x + 1

rs.movenext
wend

The response.write above returns the id, which I believe shows that the Array is being populated. However whenever I then try to call any array element, for example:

p_arrayelement = SplitArray(12)

It returns SplitArray as a blank value.

Am I missing out something where I set the items within the array or am I calling the array incorrectly? Just a couple of ideas I had but I can't find anything anywhere online.

Thanks for your help.
 
>redim SplitArray(x)
[tt]redim [blue]preserve[/blue] SplitArray(x)[/tt]
 
It's always something simple isn't it.

Thanks very much tsuji, that's worked like a charm.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top