D
DevHead
Guest
I need to transfer 144000 records from an access DB to an access DB using a VBA client app. I'm using ado recordsets to batch the inserts but its really slow, about 24 records processed per second. So it takes about an hour and 40 minutes to transfer. The retrieval time is negligeble compared to the insert time. Does anybody know a faster way to insert records into access?
Generic code below:
Generic code below:
Code:
Private Function FillDataTable(rst_RS As ADODB.Recordset, _
cnx As ADODB.Connection)
Dim rst_Flow as New ADODB.Recordset
Dim str_SQL as String
Dim int_RecCount as Integer
Do While Not rst_RS.EOF
str_SQL = "SELECT * FROM TBL1 WHERE ID = 9999999"
rst_Flow.CursorLocation = adUseClient
rst_Flow.LockType = adLockBatchOptimistic
rst_Flow.Open str_SQL, cnx
Do While Not rst_RS.EOF And (int_RecCount < 1000)
rst_Flow.AddNew
rst_Flow!Field1 = rst_RS!Field1
rst_Flow!Field2 = rst_RS!Field2
rst_Flow!Field3 = rst_RS!Field3
rst_Flow!Field4= rst_RS!Field4
rst_Flow!Field5= rst_RS!Field5
rst_Flow.Update
End If
int_RecCount = int_RecCount + 1
rst_RS.MoveNext
Loop
DoEvents
int_RecCount = 0
rst_Flow.UpdateBatch
rst_Flow.Close
Loop
End Function