sending array to table

J

Jesper F

Is it possible to send a 2-dimensional array directly to a table -
as an opposite GetRows. ?


Jesper
 
G

Guest

It would be nice if there were such a function, unfortunately, there is not.
Here is some untested air code that will do the trick.

Dim lngArrayRows as Long
Dim lngArrayCols as Long
Dim lngFieldCount as Long
Dim lngRowCount as Long
Dim rst as Recordset

lngArrayRows = Ubound(MyArray,0) - 1
lngArrayCols = Ubound(MyArray,1) -1
Set rst = CurrentDb.OpenRecordset("SomeTable", dbOpenDynaSet)
For lngLRowCount to lngArrayRows
With rst
.Add
For lngFieldCount = 0 to lngArrayRows
.fields(lngFieldCoun) = MyArray(lngRowCount, lngFieldCount)
Next lngFieldCount
.Update
End With
Next lngRowCount
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top