D
Don
Hi Folks,
probably a pretty routine question here ...
I am trying to determine the number of rows that would be returned prior to executing an Access query .
for example:
If the user selects more than 65,536 possible rows, I want to warn them and then either proceed with a subset, or give them the option of cancelling their query and specifying more selective criteria.
It is a dynamic query, which lets the users click on multiple list boxes to select the "Where" component of the excel query, and I want to enable them to select right up to the maximum number of rows.
Ultimately, it will be ODBC'ing to a Sybase database, but that is likely irrelevant.
Here is a sample of the query ...
With ActiveSheet.QueryTables.Add(Connection:=Array(Array( _
"ODBC;DSN=MS Access Database;DBQ=C:\Documents and Settings\Don McGee\My Documents\countries and cities.mdb;DefaultDir=C:\Document" _
), Array( _
"s and Settings\Don McGee\My Documents;DriverId=281;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;" _
)), Destination:=Range("N1"))
.CommandText = strQuery
.Name = "Query from MS Access Database"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With
Thanks in advance
Don
probably a pretty routine question here ...
I am trying to determine the number of rows that would be returned prior to executing an Access query .
for example:
If the user selects more than 65,536 possible rows, I want to warn them and then either proceed with a subset, or give them the option of cancelling their query and specifying more selective criteria.
It is a dynamic query, which lets the users click on multiple list boxes to select the "Where" component of the excel query, and I want to enable them to select right up to the maximum number of rows.
Ultimately, it will be ODBC'ing to a Sybase database, but that is likely irrelevant.
Here is a sample of the query ...
With ActiveSheet.QueryTables.Add(Connection:=Array(Array( _
"ODBC;DSN=MS Access Database;DBQ=C:\Documents and Settings\Don McGee\My Documents\countries and cities.mdb;DefaultDir=C:\Document" _
), Array( _
"s and Settings\Don McGee\My Documents;DriverId=281;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;" _
)), Destination:=Range("N1"))
.CommandText = strQuery
.Name = "Query from MS Access Database"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With
Thanks in advance
Don