• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 156
  • Last Modified:

Table to 2.dimensional Array

I have access table 19 columns and 5950 rows. How I can put it in two dimensionl array. I am pulling data with recordset from database.
thanks
Taras
0
Taras
Asked:
Taras
1 Solution
 
alokanantCommented:
'Assuming that you have already set rs

dim varArr(5950,19) as variant
dim row as integer
dim col as integer

rs.movefirst
for row = 0 to 5949
for col = 0 to 18
varArr(row,col) = rs.fields(col)
rs.movenext
next col
next row

hth
alok
0
 
amebaCommented:
Dim avarData() as Variant, numrecords as Long
avarData = dynMan.GetRows
numrecords = UBound(avarData, 2) + 1
0
 
Éric MoreauSenior .Net ConsultantCommented:
The GetRows method is fastest than For loops!!!
0
 
TarasAuthor Commented:
I am not sure should I put rs.movenext after next col
like it has more sens for me?
Thanks lot.
                rs.movefirst
                for row = 0 to 5949
                 for col = 0 to 18
                 varArr(row,col) = rs.fields(col)
                 
                 next col
                 rs.movenext
                 next row
0
 
alokanantCommented:
yes u r correct, place move next after next col. sorry for the mistake.

hth
alok.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now