How do I create a recordset from an Array.
I tried appending fields to teh recordset, then tried adding new records.
Something is missing somewhere, it doenst' work.
Any clues ?
Dim arrMyArray(2, 2) As String
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Fields.Append "fieldname1", adVarChar, 20
rs.Fields.Append "fieldname2", adInteger
rs.Open
arrMyArray(0, 0) = "Test" & 1
arrMyArray(1, 0) = "Test" & 2
arrMyArray(0, 1) = 1
arrMyArray(1, 1) = 2
rs.AddNew
rs!fieldname1 = arrMyArray(0, 0)
rs!fieldname2 = arrMyArray(0, 1)
rs.AddNew
rs!fieldname1 = arrMyArray(1, 0)
rs!fieldname2 = arrMyArray(1, 1)
rs.MoveFirst
For x = 0 To rs.RecordCount - 1
Debug.Print rs(0) & ", " & rs(1)
rs.MoveNext
Next
> How do I create a recordset from an Array.
> I tried appending fields to teh recordset, then tried adding new records.
> Something is missing somewhere, it doenst' work.
> Any clues ?
Dim iFor as long
Dim SArray()
Dim rstRecordset as NEW ADODB.Recordset
'Create Connection to database.
'Open Recordset..
'Loop to create Recordset
For iFor 0 to UBound(sArray)
rstRecordset.AddNew
rstRecordset.fields("MyField") = sArray(iFor)
rstRecordset.Update
next
Set rstRecordset = nothing
Set adoConnection = nothing

Signature
DEE PAYTON
> How do I create a recordset from an Array.
> I tried appending fields to teh recordset, then tried adding new records.
> Something is missing somewhere, it doenst' work.
> Any clues ?