VBA: Querying Access with Excel. Why so slow?

后端 未结 10 628
情话喂你
情话喂你 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:49

    I'm no expert, but I run almost exactly the same code with good results. One difference is that I use the Command object as well as the Connection object. Where you

    Set RST = Con.Execute(SQLQuery)
    

    I

    Dim cmd As ADODB.Command
    Set cmd.ActiveConnection = con
    cmd.CommandText = SQLQuery
    Set RST = cmd.Execute
    

    I don't know if or why that might help, but maybe it will? :-)

提交回复
热议问题