| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 
 | Private Sub ComboBox2_AfterUpdate()
Range("A1:L42").Select
Selection.ClearContents
With ActiveSheet.QueryTables.Add(Connection:=Array(Array( _
        "ODBC;DSN=;UID=;PWD=;DBQ=;DBA=W;APA=T;EXC=F;FEN=T;QTO=T;FRC=10;FDL=10;LOB=T;RST=T;BTD=F;BAM=IfAllSuccessful;NUM=NLS;DPM=F;M" _
        ), Array("TS=T;MDI=F;CSR=F;FWC=F;FBS=64000;TLO=O;")), Destination:=Range("a30") _
        )
        .CommandText = Array( _
        "SELECT SAEPEXP.VARIABLE.LIBELLE" & Chr(13) & "" & Chr(10) & "FROM SAEPEXP.VARIABLE" & Chr(13) & "" & Chr(10) & "WHERE SAEPEXP.VARIABLE.ID_SITE=(SELECT ID_SITE" & Chr(13) & "" & Chr(10) & "FROM SAEPEXP.SITE" & Chr(13) & "" & Chr(10) & "WHERE SAEPEXP.SITE.LIBELLE='ComboBox2.Value')" _
        )
        .Name = "Lancer la requête à partir de SAEP_124"
        .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
End Sub | 
Partager