1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
With ActiveSheet.QueryTables.Add(Connection:=Array(Array( _
"ODBC;DSN=MS Access Database;DBQ=\\cm\STAT\productivite.mdb;DefaultDir=\\cm\STAT\;DriverId=25;FIL=MS Access;MaxBufferSize=2048;Pa" _
), Array("geTimeout=5;")), Destination:=Range("A1"))
.CommandText = Array( _
"SELECT ORI14.`HORS PROD`, ORI14.EXPERTISE, ORI14.`PROD hors circuits`, ORI14.`Accueil téléphonique`, ORI14.`accueil électronique`, ORI14.PROD, ORI14.Total, ORI14.CLE, ORI14.Mois, ORI14.Jour, ORI14.Don" _
, _
"nées, ORI14.`Code groupe de validation`, ORI14.DATE, ORI14.`Code agent`, ORI14.`Nom agent`" & Chr(13) & "" & Chr(10) & "FROM `\\cm\STAT\productivite.mdb`.ORI14 ORI14" & Chr(13) & "" & Chr(10) & "WHERE (ORI14.DATE>={ts '" & Format(observationdeb, "yyyy-mm-dd hh:mm:ss") & "'} And ORI14.DATE<={ts '" & Format(observationfin, "yyyy-mm-dd hh:mm:ss") & "'}" _
, ")")
.Name = "Lancer la requête à partir de 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 |
Partager