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 26 27 28 29
|
Private Sub calcul_NbFournisseurs(objMyDB As ADODB.Connection, mois As String)
Dim rsData As ADODB.Recordset
Dim strSQL As String
Dim leSecteur As String
Dim nbFournisseurs As Double
strSQL = "SELECT c.nomSecteur, Count(a.supplierCode) AS CountOfsupplierCode "
strSQL = strSQL & "FROM (SELECT DISTINCT b.codeSecteur, supplierCode, IIf(CurrentETD<>'',month(CurrentETD),month(InitialETD)) as leMois FROM TimportFollowUp, TDrayonSecteur as b "
strSQL = strSQL & " WHERE IIf(CurrentETD<>'',month(CurrentETD),month(InitialETD))=" & Month(mois) & " "
strSQL = strSQL & " AND left(Department,2)=b.codeRayon "
strSQL = strSQL & " AND orderCurrentStatus<>'A') AS a, TDsecteur as c "
strSQL = strSQL & "WHERE c.idSecteur=a.codeSecteur "
strSQL = strSQL & "GROUP BY c.nomSecteur;"
Set rsData = New ADODB.Recordset
rsData.Open strSQL, objMyDB, adOpenDynamic
Do Until rsData.EOF
leSecteur = rsData.Fields("nomSecteur")
majTRresultat objMyDB, mois, "AIG", 87, leSecteur, Nz(rsData.Fields(1), "")
rsData.MoveNext
Loop
rsData.Close
Set rsData = Nothing
End Sub |
Partager