sending array to table

  • Thread starter Thread starter Jesper F
  • Start date Start date
J

Jesper F

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


Jesper
 
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
 
Back
Top