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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| Private Sub CmdFiltre_Click()
f = ""
If Not IsNull(Me.Consignor) And Me.Consignor <> "" Then
f = "Fournisseur LIKE ""*" & Me.Consignor & "*"""
End If
If Not IsNull(Me.Consignee) And Me.Consignee <> "" Then
If f <> "" Then
f = f & " AND Importateur LIKE ""*" & Me.Consignee & "*"""
Else
f = "Importateur LIKE ""*" & Me.Consignee & "*"""
End If
End If
If Not IsNull(Me.Pays) And Me.Pays <> "" Then
If f <> "" Then
f = f & " AND [Pays d'origine] LIKE ""*" & Me.Pays & "*"""
Else
f = "[Pays d'origine] LIKE ""*" & Me.Pays & "*"""
End If
End If
If Not IsNull(Me.Résultat) And Me.Résultat <> "" Then
If f <> "" Then
f = f & " AND [Résultat du contrôle] LIKE ""*" & Me.Résultat & "*"""
Else
f = "[Résultat du contrôle] LIKE ""*" & Me.Résultat & "*"""
End If
End If
If Not IsNull(Me.Labo) And Me.Labo <> "" Then
If f <> "" Then
f = f & " AND [Envoi laboratoire] LIKE ""*" & Me.Labo & "*"""
Else
f = "[Envoi laboratoire] LIKE ""*" & Me.Labo & "*"""
End If
End If
If Not IsNull(Me.Catégorie) And Me.Catégorie <> "" Then
If f <> "" Then
f = f & " AND [Catégorie produits] LIKE ""*" & Me.Catégorie & "*"""
Else
f = "[Catégorie produits] LIKE ""*" & Me.Catégorie & "*"""
End If
End If
If Not IsNull(Me.Nature) And Me.Nature <> "" Then
If f <> "" Then
f = f & " AND [Nature du produit] LIKE ""*" & Me.Nature & "*"""
Else
f = "[Nature du produit] LIKE ""*" & Me.Nature & "*"""
End If
End If
If Not IsNull(Me.Date1) And Me.Date1 <> "" And Not IsNull(Me.Date2) And Me.Date2 <> "" Then
If f <> "" Then
f = f & " AND clng([Date résultat]) BETWEEN " & CLng(Me.Date1) & " AND " & CLng(Me.Date2) & ""
Else
f = "clng([Date résultat]) BETWEEN " & CLng(Me.Date1) & " AND " & CLng(Me.Date2) & ""
End If
End If
Me.Filter = f
Me.FilterOn = True
End Sub |
Partager