L
LarryP
Working with arrays gives me vertigo!
I want to loop through a recordset and store two pieces of information in an
array, re-sizing the array with Redim Preserve as I process each new record
in the recordset. The populated array should look like this:
Thing1, .25
Thing2, 1.43
Thing3, .07
etc.
But I'm not seeing the forest for the trees -- my code throws a "subscript
out of range" on the second Redim. I've tweaked it various ways, most recent
version is
x = 0
Rs.MoveFirst
Do While Not Rs.EOF
ReDim Preserve varPriceTable(x + 1, x + 1)
varPriceTable(x, 0) = Rs!LookupString
varPriceTable(x, 1) = Rs!ZPMILEPrice
x = x + 1
Rs.MoveNext
Loop
Somebody please help me take the blinders off! ;>)
I want to loop through a recordset and store two pieces of information in an
array, re-sizing the array with Redim Preserve as I process each new record
in the recordset. The populated array should look like this:
Thing1, .25
Thing2, 1.43
Thing3, .07
etc.
But I'm not seeing the forest for the trees -- my code throws a "subscript
out of range" on the second Redim. I've tweaked it various ways, most recent
version is
x = 0
Rs.MoveFirst
Do While Not Rs.EOF
ReDim Preserve varPriceTable(x + 1, x + 1)
varPriceTable(x, 0) = Rs!LookupString
varPriceTable(x, 1) = Rs!ZPMILEPrice
x = x + 1
Rs.MoveNext
Loop
Somebody please help me take the blinders off! ;>)