Bonjour la communauté

Dans un formulaire de recherche j'ai voulu ajouter un type de recherche, les livraisons

La requète "R_Resultats" :

Nom : Capture.JPG
Affichages : 28
Taille : 137,5 Ko

Le resulat de la requète :

Nom : Capture.JPG
Affichages : 24
Taille : 118,7 Ko

La requète "R_ResultatsFiltre" :

Nom : Capture.JPG
Affichages : 24
Taille : 110,0 Ko

Le résultat de la requête :

Nom : Capture.JPG
Affichages : 25
Taille : 116,9 Ko

Mon formulaire :

Nom : Capture.JPG
Affichages : 25
Taille : 144,4 Ko

La requète du combox "CboSearchLivraisons"

Code : Sélectionner tout - Visualiser dans une fenêtre à part
SELECT DISTINCT R_ResultatsFiltre.[Livraison] FROM R_ResultatsFiltre ORDER BY R_ResultatsFiltre.[Livraison];
Nom : Capture.JPG
Affichages : 26
Taille : 37,1 Ko

L'evenement qui lance la procédure, sur click du combobx

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
Private Sub FilterForm()
    Dim strWhere As String, s As String
    Dim DateDebutPeriode As Variant
    Dim DateFinPeriode As Variant
    strWhere = ""
 
    'Filtre suivant date du jour
    If Not IsNull(Me.cboSearchDate_Jour) And Me.cboSearchDate_Jour <> "" Then
        strWhere = "AND [Date_mouvement] = " & Format(Me.cboSearchDate_Jour, FormatDate) & ""
    End If
 
    'Filtre suivant l'année
    If Not IsNull(Me.cboSearchAnnee) And Me.cboSearchAnnee <> "" Then
        strWhere = "AND [Annee_mouvement] = " & Me.cboSearchAnnee & ""
    End If
 
    'Filtre suivant le Mois
    If Not IsNull(Me.cboSearchMois) And Me.cboSearchMois <> "" Then
        strWhere = "AND [Mois_mouvement] = " & Me.cboSearchMois & ""
    End If
 
    'Filtre suivant la semaine
    If Not IsNull(Me.cboSearchSemaine) And Me.cboSearchSemaine <> "" Then
        strWhere = "AND [Semaine_mouvement] = " & Me.cboSearchSemaine & ""
    End If
 
    'Filtre suivant N° Imputations
    If Not IsNull(Me.Cbo_SearchImputations) And Me.Cbo_SearchImputations <> "" Then
        strWhere = strWhere & " AND [ID_Imputations] = " & Me.Cbo_SearchImputations & ""
        'strWhere = strWhere & " AND [NumeroImputation] = " & Me.Cbo_SearchImputations & ""
    End If
 
    '--- Filtre suivant demandeur
    If Not IsNull(Me.Cbo_SearchDemandeurs) And Me.Cbo_SearchDemandeurs <> "" Then
        strWhere = strWhere & " AND [NomPrn] = '" & Me.Cbo_SearchDemandeurs & "'"
    End If
 
    '--- Filtre suivant Référence Produit
    If Not IsNull(Me.Cbo_SearchReferenceProduits) And Me.Cbo_SearchReferenceProduits <> "" Then
        strWhere = strWhere & " AND [Reference_Produit] = '" & Me.Cbo_SearchReferenceProduits & "'"
    End If
 
    '--- Filtre suivant désignation
    If Not IsNull(Me.Cbo_SearchDesignation) And Me.Cbo_SearchDesignation <> "" Then
        strWhere = strWhere & " AND [Designation_Produit] = '" & Me.Cbo_SearchDesignation & "'"
    End If
 
    '--- Filtre suivant l'état
    If Not IsNull(Me.CboSearchEtat) And Me.CboSearchEtat <> "" Then
        strWhere = strWhere & " AND [Etat] = '" & Me.CboSearchEtat.Column(1) & "'"
    End If
 
    'Par etat de pointage
    If Not IsNull(Me.CboSearchPointe) And Me.CboSearchPointe <> "" Then
        strWhere = strWhere & " AND [Mouvement_Pointe] = " & Me.CboSearchPointe
    End If
 
    'Par Livraison
    If Not IsNull(Me.CboSearchLivraisons) And Me.CboSearchLivraisons <> "" Then
        strWhere = strWhere & " AND [Livraison] = " & Me.CboSearchLivraisons
    End If
 
    'Par periodee
    If Not IsNull(Me.TxtB_DebutPeriode) And Not IsNull(Me.TxtB_FinPeriode) And IsDate(Me.TxtB_DebutPeriode) And IsDate(Me.TxtB_FinPeriode) _
        And Me.TxtB_FinPeriode > Me.TxtB_DebutPeriode Then
        strWhere = strWhere & " AND [Date_Mouvement] BETWEEN " & Format(Me.TxtB_DebutPeriode, "\#dd\/mm\/yyyy\#") & "" _
                        & " AND " & Format(Me.TxtB_FinPeriode, "\#dd\/mm\/yyyy\#")
End If
 
    Debug.Print "strWhere: "; strWhere
    If strWhere = "" Then
        Me.Filter = ""
        Me.FilterOn = False
        CurrentDb.QueryDefs("R_ResultatsFiltre").SQL = sSQL
    Else
        strWhere = Mid(strWhere, 5)
        Me.Filter = strWhere
        Me.FilterOn = True
 
        '--- les champs calculés sont à remplacer par leurs formules de calcul
        s = sSQL & " WHERE " & strWhere & ";"
        s = Replace(s, "[Mois_Mouvement]", "Month([Date_Mouvement])")
        s = Replace(s, "[Annee_Mouvement]", "Year([Date_Mouvement])")
        s = Replace(s, "[Semaine_Mouvement]", "ISOWeek([Date_Mouvement])")
        CurrentDb.QueryDefs("R_ResultatsFiltre").SQL = s
    End If
End Sub
Et bien cela ne fonctionne pas sur cette recherche.

Une idée?

Si besoin de plus d'infos, n'hésitez pas.

Merci beaucoup

Passez une bonne journée.

LeLighteux26