B
Ben
Hi,
each time the row is change(R=R+1) a new query is created. But the
problem is with the result s destination. Except for the first time datas are
inserted, each time datas are inserted in Range("K" & R & ""), it creates a
new column.
Go figure!
Thank you
Do Until Cells(R, 5) = "TOTAL:"
R = 8
FrstDay = 7
LastDay = 14
Card1 = Cells(R, 4)
Sqlstring = "select sum(Temps_Arrondi) from Presence_BCV_App where
Card= '" & Card1 & "' and ([Date] > '" & FrstDay & "' and [Date] < '" &
LastDay & "') "
connstring = "ODBC;DSN=DEV_DCI;UID=sa;PWD=abcde;Database=DEV_DCI"
With
ActiveSheet.QueryTables.Add(Connection:=connstring,Destination:=Range("K" &
R),Sql:=sqlstring)
.Refresh BackgroundQuery = False
End With
R = R + 1
Loop
each time the row is change(R=R+1) a new query is created. But the
problem is with the result s destination. Except for the first time datas are
inserted, each time datas are inserted in Range("K" & R & ""), it creates a
new column.
Go figure!
Thank you
Do Until Cells(R, 5) = "TOTAL:"
R = 8
FrstDay = 7
LastDay = 14
Card1 = Cells(R, 4)
Sqlstring = "select sum(Temps_Arrondi) from Presence_BCV_App where
Card= '" & Card1 & "' and ([Date] > '" & FrstDay & "' and [Date] < '" &
LastDay & "') "
connstring = "ODBC;DSN=DEV_DCI;UID=sa;PWD=abcde;Database=DEV_DCI"
With
ActiveSheet.QueryTables.Add(Connection:=connstring,Destination:=Range("K" &
R),Sql:=sqlstring)
.Refresh BackgroundQuery = False
End With
R = R + 1
Loop