views:

145

answers:

1

I want my multidimensional array to be dynamic, when I am trying to do that using reDim i am getting the error "This array is fixed or temporarily locked:refArr ", Following is my code:

max=10
dim refArr(10,2)


dim i
i=0
while not rs1.eof

        max=max+1
        redim refArr(max,2)

    niftyChange=0

        refArr(i,0)="niftyDate" 
        refArr(i,1)="temp"

    i=i+1
    rs1.movenext

wend
+1  A: 

If you are going to ReDim it, you need to dim it with no size initially:

dim refArr() 

I think you actually want to use ReDim Preserve, though, to keep the existing data.

RedFilter
Hey Thanks, It is working now.. Will you please elaborate on 'preserve' a little bit more? When i wont use preserve, will I lose all data?
Girish k.
I learned that if i dont use preserve, I ll lose all data and If I do use it, then I ll only be able to resize only the last dimension. But as done in my coding, I gotto resize first dimension, otherwise it wont work. I*s there any way out of it..
Girish k.
Just swap your dimensions and iteration accordingly. Does it matter which dimension comes first?
RedFilter