I found this code online to query Access and input the data into excel (2003), but it is much slower than it should be:
Sub DataPull(SQLQuery, CellPaste)
Dim
-
If you retrieve a lot of records, it would explain why the Range(CellPaste)
takes so long. (If you execute the query in Access it wouldn't retrieve all the records, but if you do the CopyFromRecordset it requires all the records.)
There is a MaxRows parameter for CopyFromRecordset:
Public Function CopyFromRecordset ( _
Data As Object, _
MaxRows As Object, _
MaxColumns As Object _
) As Integer
Try if settings this to a low value (like 10 or so) changes the performance.
- 热议问题