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
| strfiltre = ""
If TxTClient <> "" And Not IsNull(TxTClient) Then
strfiltre = "nomcli = '" & Replace(TxTClient, "'", "''") & "'"
Else
strfiltre = "NomCli <> 'Test' AND IDCli <> '0' AND IdCli <> '9999999' "
End If
If ComboLiv <> "" And Not IsNull(ComboLiv) Then
If strfiltre <> "" Then
strfiltre = strfiltre & " AND "
End If
If ComboLiv = "Livré" Then
ComboLiv = 1
End If
If ComboLiv = "Non Livré" Then
ComboLiv = 0
End If
strfiltre = strfiltre & "Expedier = '" & ComboLiv & "'"
End If
If TxtDateFrom <> "" And Not IsNull(TxtDateFrom) Then
If strfiltre <> "" Then
strfiltre = strfiltre & " AND "
End If
strfiltre = strfiltre & "date01 between '" + Format(TxtDateFrom, "yyyy/mm/dd") + "' and '" + Format(txtDateTo, "yyyy/mm/dd") + "'"
End If
If strfiltre <> "" Then
strfiltre = "WHERE " & strfiltre
End If
CnxPro.Open "Provider=SQLOLEDB;Server=mecinov;uid=Production;pwd=Production;database=suiviprod"
DBSuiviProdSQL.Open "SELECT Commande,Expedier FROM produits , CnxPro, adOpenStatic, adLockReadOnly"
DBCommandesSQL.Open "SELECT Status.NomCli,Status.idMecinov,Status.Date01,Produits.Commande FROM status inner join Produits on Status.idMecinov = Produits.Commande " & strfiltre, CnxCom, adOpenStatic, adLockReadOnly |
Partager