Copy MS Access Table into a VBA Array

I am trying to read an entire MS Access table in to a VBA array.  What is the best way to do this?
LVL 5
mvs10000Asked:
Who is Participating?
 
flavoCommented:
   Dim v() As Variant
   
    Dim rs As ADODB.Recordset
    Set rs = New ADODB.Recordset
   
    rs.Open "SELECT * FROM tblData", CurrentProject.Connection, adOpenDynamic, adLockReadOnly
    v = rs.GetRows
    rs.Close
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Just out of curiosity, why do you wish to do this?

Either way (using ADO)

Dim cn as ADODB.Connection
Set cn = CurrentProject.Connection

Dim rs as ADODB.Recordset
Set rs = New ADODB.Recordset

Dim arr() as Variant

rs.Open "SELECT * FROM SomeTableName"

arr = rs.GetRows
0
 
dannywarehamCommented:
Seriously...!? Why?

0
 
mvs10000Author Commented:
I am trying to read an Access table to Area.
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.

All Courses

From novice to tech pro — start learning today.