1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| Dim SQL As String
Dim rst As Recordset
Dim DateNow As Date
Dim Maintenant As String
DateNow = Now()
Maintenant = Format(DateNow, "mm")
DoCmd.SetWarnings False
SQL = "SELECT Sum(T_ImportInterventionsClean.[Montant Facturé]) AS [SommeDeMontant Facturé] " & _
"From T_ImportInterventionsClean " & _
"GROUP BY Format([T_ImportInterventionsClean]![Début intervention],"mm") " & _
"HAVING (((Format([T_ImportInterventionsClean]![Début intervention],"mm"))= " & Maintenant & "));"
Set rst = CurrentDb.OpenRecordset(SQL, dbOpenSnapshot)
Forms("Menu Général Access").Controls("T_FacturableMois") = rst("[Montant Facturé]")
rst.Close
End Sub |