ProgramRasta
Member
- Local time
- Today, 17:48
- Joined
- Feb 27, 2020
- Messages
- 98
Hi All
I am attempting to import certain columns from Excel into an Access table.
However, I'm getting severe delays in updating the table using the below code.
I was wondering if my code is inefficient, Access is just slow at these type of updates or if I'm missing a trick somewhere.
For reference, there are 4000 rows in my Excel spreadsheet.
Your wisdom is appreciated!
Many thanks
I am attempting to import certain columns from Excel into an Access table.
However, I'm getting severe delays in updating the table using the below code.
I was wondering if my code is inefficient, Access is just slow at these type of updates or if I'm missing a trick somewhere.
For reference, there are 4000 rows in my Excel spreadsheet.
Code:
r = 2
Do While Excel.Range("A" & r).Value <> Empty
field1 = Excel.Range("A" & r).Value
field2 = Excel.Range("B" & r).Value
field3 = Excel.Range("C" & r).Value
Set ImportRS = dbs.OpenRecordset("table1", dbOpenDynaset)
With ImportRS
.AddNew
.Fields("Field_1") = field1
.Fields("Field_2") = field2
.Fields("Field_3") = field3
.Update
End With
r = r + 1
Loop
Your wisdom is appreciated!
Many thanks