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
| TxtSQLGlobal = "select * " & _
"from soldeTest where (DateFacture between '" & Date1 & "' and '" & Date2 & "') and (CodeArticle between '" & Article1 & "'and '" & Article2 & "')order by NDossier,DateFacture"
TxtSQLGlobal2 = "select * " & _
"from soldeTest where (DateFacture between '" & Date1 & "' and '" & Date2 & "') and (CodeArticle between '" & Article1 & "'and '" & Article2 & "')order by NDossier,DateFacture"
Set li = New ADODB.Recordset
Set li2 = New ADODB.Recordset
li.Open TxtSQLGlobal, ConnectionGlobal, adOpenStatic, adLockOptimistic
li2.Open TxtSQLGlobal2, ConnectionGlobal, adOpenStatic, adLockOptimistic
li.MoveFirst
'li2.MoveFirst
While li.EOF = False
li2.MoveFirst
While li2.EOF = False
li2.MoveNext
'Array1 = li2.GetRows(j + 1)
'typ = Array1(19, j + 1)
'MsgBox (typ)
If li.Fields("DateFacture") = li2.Fields("DateFacture") And li.Fields("NDossier") = li2.Fields("NDossier") And li.Fields("TypeFacture") = "Livraison Client" And li2.Fields("TypeFacture") = "Livraison Client" Then
MsgBox ("oui")
If (li.Fields("total02") <> 0) Then
li.Fields("total03") = li.Fields("total03") - li.Fields("total02")
End If
End If
Wend
li.MoveNext
Wend |