Access Write array data to access table


Joined
May 16, 2013
Messages
2
Reaction score
0
Hi All,

Can i write array data to access table without looping ?

dim db as database
dim rs1 as recordset
dim rs2 as recordset
dim arr1 as Variant
dim R1 as long
dim R2 as long

set db = currentdb()
set rs1 = db.openrecordset("Select * from Table1)
set rs2 = db.openrecordset("Select * from Table2)

for R1 = Lbound(arr1,2) to Ubound(arr1,2)
rs2.AddNew
for C1 = Lbound(arr1,1) to Ubound(arr1,1)
rs2.fields(C1).Value = arr1(C1,R1)
Next C1
rs2.Update
rs2.MoveNext
Next R1

Thanks
 
Ad

Advertisements


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