1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
dim cpte as Variant
cpte = "(DELAIS.EXDCOQY = " & 208131 & ") OR (DELAIS.EXDCOQY = " & 208102 & ") OR (DELAIS.EXDCOQY = " & 208107 & ")"
With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DSN=CLT;DBQ=J:\ACCESS\CLIENTS.mdb;DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;" _
, Destination:=Range("A2"))
.CommandText = Array( _
"SELECT DELAIS.EXDDTKV, DELAIS.EXDCOQY, DELAIS.EXDCD, DELAIS.EXDHESI, DELAIS.DELAIS" & Chr(13) & "" & Chr(10) & "FROM `J:\BASE_DE_DONNEES_ACCESS\INFOS_CLIENTS`.DELAIS DELAIS" & Chr(13) & "" & Chr(10) & "WHERE " & cpte & " AND (DELAIS.EXDHESI>" & heure_theo & ")" & Chr(13) & "" & Chr(10) & "ORDER BY DELAIS.EXDCD")
.Name = "Lancer la requête à partir de CLT_test3"
.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