I'm trying to assign a set of values to a array variable.
I have declared a variabl as
Public arrvar (1 To 40, 1 To 1000) As Variant
in the script i'm using this variable as
SQLQuery = "Select name, pos From Table Where pagedetails.pageid = '" & pageId & "'"
arrvar = cnn.Execute(SQLQuery)
but it is giving an error saying that can not assign to an array.
Is this method is correct or did i mis something.
Thanks in advance
Thanks and Regards
Why are you declaring the variable "arrvar" public?
I have seen the same issue. I got around it by using the following statement:
ReDim arrvar (40,1000) As Variant
Not sure why ReDim worked when Dim or Public wouldn't, but it did.
Try moving from arrays to recordsets in memory.
You will have a lot of flexibility esp since you are trying to store the data from a SQL into an array.