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 30 31 32 33 34 35 36 37 38 39 40 41
| Dim i As Integer
Set rsligne_fact_four = New ADODB.Recordset
rsligne_fact_four.Open "select * from ligne_facture_four where Code_four= '" & Combo1.Text & "'", cn, 1, 2
Set rsfact_four = New ADODB.Recordset
rsfact_four.Open " select * from Facture_four where Code_fou = '" & Combo1.Text & " '", cn, 1, 2
If rsligne_fact_four.RecordCount = 0 Then
MsgBox "Il n'y a aucun facture saisie", vbInformation, "MAC//Z"
Exit Sub
Else
With g
.FixedRows = 1 'ligne en-tete
.Rows = 2 ' + une ligne vide
i = 1
rsligne_fact_four.MoveFirst
Do While Not rsligne_fact_four.EOF
If rsligne_fact_four.Fields(4) = Combo1.Text Then
i = i + 1
.Rows = i 'nombre de ligne
.Row = i - 1 'ligne courante
.Col = 0
.Text = rsligne_fact_four.Fields(0)
.Col = 1
.Text = rsfact_four.Fields(1)
.Col = 2
.Text = rsligne_fact_four.Fields(3)
.Col = 3
.Text = rsligne_fact_four.Fields(4)
.Col = 4
.Text = rsligne_fact_four.Fields(5)
End If
rsligne_fact_four.MoveNext
Loop
End With
End If
End Sub |
Partager