VBA: Querying Access with Excel. Why so slow?

后端 未结 10 621
情话喂你
情话喂你 2021-01-18 03:24

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         


        
10条回答
  •  迷失自我
    2021-01-18 03:55

    What about the following turnarounds or improvements:

    1. Once opened, save the recordset as xml file (rst.saveToFile xxx) and then have Excel reopen it.
    2. Once opened, put recordset data in an array (rst.getRows xxx), and copy the array on the active sheet
    3. And, at any time, minimise all memory / access requirements: open the recordset as read-only, forward only, close the connection once the data is on your side, etc.

提交回复
热议问题