Salut je t'envoie le code que j'ai développé et qui bien sur ne marche pas , jet un coup d ½il et dit moi ce que tu en pense . A+
Private Sub afficheRequete()
Dim sql1 As String
Dim sql As String
Dim sql2 As String
Set rst = New ADODB.Recordset
Set rst1 = New ADODB.Recordset
Set rst2 = New ADODB.Recordset
If Not DataCombo2.Text = "" Then
sql1 = "SELECT Sum(cheque) AS totalcheq From table_achat" & _
" where fournisseur='" & DataCombo2.BoundText & "'"
sql = "SELECT Sum(especes) AS totales From table_achat" & _
" where fournisseur='" & DataCombo2.BoundText & "'"
sql2 = "SELECT Sum(cb) AS totalcb From table_achat" & _
" where fournisseur='" & DataCombo2.BoundText & "'"
Else
Label12.Caption = ""
Label10.Caption = ""
Label5.Caption = ""
End If
DataGrid1.Refresh
rst.CursorType = adOpenKeyset
rst.Open sql, conn
If rst.RecordCount > 0 Then
Label12.Caption = rst("totales")
End If
DataGrid1.Refresh
rst1.CursorType = adOpenKeyset
rst1.Open sql1, conn
If rst1.RecordCount > 0 Then
Label10.Caption = rst1("totalcheq")
End If
DataGrid1.Refresh
rst2.CursorType = adOpenKeyset
rst2.Open sql2, conn
If rst2.RecordCount > 0 Then
Label5.Caption = rst2("totalcb")
End If
rst2.Close
rst1.Close
rst.Close
End Sub