bonjour
voila j'ai un probleme avec where
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:= _
"ODBC;DSN=*****;UID=Administrateur;Trusted_Connection=Yes;APP=Microsoft Office 2010;WSID=DELL06;DATABASE=*****" _
, Destination:=Range("$A$1")).QueryTable
.CommandText = Array( _
"SELECT F_POINTAGE.DO_Piece, F_POINTAGE.RP_Code, F_POINTAGE.AR_ref, F_POINTAGE.Date_Saisie, F_POINTAGE.DL_Qte, F_POINTAGE.Initiales" _
& Chr(13) & "" & Chr(10) & "FROM ******.dbo.F_POINTAGE WHERE year(Date_Saisie)='2017' and Initiales IN ('SOFC0065','SOFC0105') and RP_Code IN('021COFCTRL','021COFEMBA') ")
ceci ne fonctionne pas
si je fais
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:= _
"ODBC;DSN=*****;UID=Administrateur;Trusted_Connection=Yes;APP=Microsoft Office 2010;WSID=DELL06;DATABASE=*****" _
, Destination:=Range("$A$1")).QueryTable
.CommandText = Array( _
"SELECT F_POINTAGE.DO_Piece, F_POINTAGE.RP_Code, F_POINTAGE.AR_ref, F_POINTAGE.Date_Saisie, F_POINTAGE.DL_Qte, F_POINTAGE.Initiales" _
& Chr(13) & "" & Chr(10) & "FROM *******.dbo.F_POINTAGE WHERE Initiales IN ('SOFC0065','SOFC0105') and RP_Code IN('021COFCTRL','021COFEMBA') ")
la c'est bon
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:= _
"ODBC;DSN=*****;UID=Administrateur;Trusted_Connection=Yes;APP=Microsoft Office 2010;WSID=DELL06;DATABASE=****" _
, Destination:=Range("$A$1")).QueryTable
.CommandText = Array( _
"SELECT F_POINTAGE.DO_Piece, F_POINTAGE.RP_Code, F_POINTAGE.AR_ref, F_POINTAGE.Date_Saisie, F_POINTAGE.DL_Qte, F_POINTAGE.Initiales" _
& Chr(13) & "" & Chr(10) & "FROM ******.dbo.F_POINTAGE WHERE year(Date_Saisie)='2017' and Initiales IN ('SOFC0065','SOFC0105') ")
la aussi
mais avec condition cela ne fonctionne pas
merci d'avance pour votre aide