bs0d
Well-known Member
- Joined
- Dec 29, 2006
- Messages
- 622
I'm curious what items are necessary in the Macro Recorded MS Query code. Below is an example. What items can you remove, and will it improve the speed of the query at all?
For example, can you alter the buffer size up or down? What are the implications? PageTimeout? And all the "FALSE" items below, what if you didn't list those properties at all?
For example, can you alter the buffer size up or down? What are the implications? PageTimeout? And all the "FALSE" items below, what if you didn't list those properties at all?
Code:
With
Sheets("GroupData").ListObjects.Add(SourceType:=0, Source:=Array(Array( _
"ODBC;DSN=MS Access Database;DBQ=L:\Historical\db\history.accdb;DefaultDir=L:\Production - Historical\db;DriverId=2" _
), Array("5;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;")), Destination:= _
Sheets("GroupData").Range("$A$1")).QueryTable
.CommandText = sSQL
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.PreserveColumnInfo = True
.ListObject.DisplayName = "QueryGroupData"
.Refresh BackgroundQuery:=False
End With