View Single Post
  #7 (permalink)  
Old July 29th, 2004, 05:13 PM
Bob Bedell Bob Bedell is offline
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

Probably want to use a variant array to accomodate non-string data type fields:

Public Sub FillArrayADO()
    Dim rst As ADODB.Recordset
    Dim cnn As ADODB.Connection
    Dim strConnection As String
    Dim strSQL As String
    Dim arrRows As Variant
    Dim intRow As Integer

    strConnection = "PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
      "Data Source=C:\Test.mdb;"

    Set cnn = New ADODB.Connection
    cnn.Open (strConnection)

    Set rst = New ADODB.Recordset
    strSQL = "SELECT * FROM tblTest"
    rst.Open strSQL, cnn, adOpenStatic, adLockReadOnly, adCmdText

    ' Load array
    arrRows = rst.GetRows()

    ' Print array elements
    For intRow = 0 To UBound(arrRows, 2)
        Debug.Print " " & _
            arrRows(0, intRow) & " " & _
            arrRows(1, intRow)
    Next intRow

    rst.Close
    cnn.Close

End Sub

HTH,

Bob