assigning values to arrays from query

assigning values to arrays from query

Post by jon » Fri, 31 May 2002 03:21:33



hi!
how do i assign values from an access query to a two dimensional array in
vb?
i've tried this;

Dim Matrix(1 To 25, 5 To 30)

datPoints.Recordset.MoveFirst

For i = 1 To 25
    For j = 5 To 30
         Matrix(i, j) = datPoints.Recordset.Fields(j)
    Next j
    datPoints.Recordset.MoveNext
Next i

what am i doing wrong?!

/jon

 
 
 

assigning values to arrays from query

Post by Norman Yua » Fri, 31 May 2002 00:54:30


what is the error?

> hi!
> how do i assign values from an access query to a two dimensional array in
> vb?
> i've tried this;

> Dim Matrix(1 To 25, 5 To 30)

> datPoints.Recordset.MoveFirst

> For i = 1 To 25
>     For j = 5 To 30
>          Matrix(i, j) = datPoints.Recordset.Fields(j)
>     Next j
>     datPoints.Recordset.MoveNext
> Next i

> what am i doing wrong?!

> /jon


 
 
 

assigning values to arrays from query

Post by TM » Fri, 31 May 2002 09:12:11


Hi

It seems to me that you are rather assigning the field and not it's value. I
suppose that it is the field's value that you want be Matrix(i,j) value

 Matrix(i, j) = datPoints.Recordset.Fields(j).Value

Hope this helps.
TM


> hi!
> how do i assign values from an access query to a two dimensional array in
> vb?
> i've tried this;

> Dim Matrix(1 To 25, 5 To 30)

> datPoints.Recordset.MoveFirst

> For i = 1 To 25
>     For j = 5 To 30
>          Matrix(i, j) = datPoints.Recordset.Fields(j)
>     Next j
>     datPoints.Recordset.MoveNext
> Next i

> what am i doing wrong?!

> /jon