Visual Basic para Aplicaciones - Buscador en access no me funciona

Life is soft - evento anual de software empresarial
   
Vista:

Buscador en access no me funciona

Publicado por Xabi (9 intervenciones) el 24/05/2016 08:34:51
hola tengo un buscador que me sirve para filtrar los campos que necesito y el resto no me los filtre. Pero al darle al boton para iniciar el codigo empieza a hacer la consulta pero al final no me muestra nada. Aqui les dejo el codigo:
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
Function Resultados()
    Set db = CurrentDb
    Dim dejaCondition As Boolean
 
    Dim PRODUCT As Variant
    PRODUCT = Forms!Buscador!Menu!C_Produit.Value
 
    Dim PRODUCT_DESC As Variant
    PRODUCT_DESC = Forms!Buscador!Menu!C_ProduitDesc.Value
 
    Dim PRODUCT_GROUP As Variant
    PRODUCT_GROUP = Forms!Buscador!Menu!C_ConditProduit.Value
 
    Dim EV_CODE As Variant
    EV_CODE = Forms!Buscador!Menu!C_CodeEvenement.Value
 
    Dim EV_DESC As Variant
    EV_DESC = Forms!Buscador!Menu!C_CodeEvenement.Value
 
    Dim EV_TYPE As Variant
    EV_TYPE = Forms!Buscador!Menu!C_TypeEvenement.Value
 
    Dim EV_SUB_TYPE As Variant
    EV_SUB_TYPE = Forms!Buscador!Menu!C_SousTypeEvenement.Value
 
    Dim EV_DATA As Variant
    EV_DATA = Forms!Buscador!Menu!C_DonneeEvenement.Value
 
    Dim EV_COMMENT As Variant
    EV_COMMENT = Forms!Buscador!Menu!C_Commentaire.Value
 
    Dim OPERATOR_ID As Variant
    OPERATOR_ID = Forms!Buscador!Menu!C_IDOperateur.Value
 
    Dim OPERATOR As Variant
    OPERATOR = Forms!Buscador!Menu!C_Operateur.Value
 
    Dim CREW_NUMBER As Variant
    CREW_NUMBER = Forms!Buscador!Menu!C_Equipe.Value
 
    Dim WORKSHOP As Variant
    WORKSHOP = Forms!Buscador!Menu!C_Atelier.Value
 
    Dim MACHINE_TYPE As Variant
    MACHINE_TYPE = Forms!Buscador!Menu!C_TypeMachine.Value
 
    Dim MACHINE_NO As Variant
    MACHINE_NO = Forms!Buscador!Menu!C_NumMachine.Value
 
    Dim BARCODE As Variant
    BARCODE = Forms!Buscador!Menu!C_CodePrimaire.Value
 
    If PRODUCT & PRODUCT_DESC & PRODUCT_GROUP & EV_CODE & EV_DESC & EV_TYPE & EV_SUB_TYPE & EV_DATA & EV_COMMENT & OPERATOR_ID & OPERATOR & CREW_NUMBER & WORKSHOP & MACHINE_TYPE & MACHINE_NO & BARCODE = "" Then
    Else: Requete = Requete & "WHERE "
        If PRODUCT <> "" Then
            Requete = Requete & "[PRODUCT] LIKE '*" & PRODUCT & "*' "
            dejaCondition = True
        End If
        If PRODUCT_DESC <> "" Then
            If dejaCondition Then
                Requete = Requete & "AND [PRODUCT_DESC] LIKE '*" & PRODUCT_DESC & "*' "
            Else
                Requete = Requete & "[PRODUCT_DESC] LIKE '*" & PRODUCT_DESC & "*' "
                dejaCondition = True
            End If
        End If
 
       If PRODUCT_GROUP <> "" Then
            If dejaCondition Then
                Requete = Requete & "AND [PRODUCT_GROUP] = '" & PRODUCT_GROUP & "' "
            Else
                Requete = Requete & "[PRODUCT_GROUP] = '" & PRODUCT_GROUP & "' "
                dejaCondition = True
            End If
        End If
        If EV_CODE <> "" Then
            If dejaCondition Then
                Requete = Requete & "AND [EV_CODE] = '" & EV_CODE & "' "
            Else
                Requete = Requete & "[EV_CODE] = '" & EV_CODE & "' "
                dejaCondition = True
            End If
         End If
        If EV_DESC <> "" Then
            If dejaCondition Then
                Requete = Requete & "AND [EV_DESC] LIKE '*" & EV_DESC & "*' "
            Else
                Requete = Requete & "[EV_DESC] LIKE '*" & EV_DESC & "*' "
                dejaCondition = True
            End If
             End If
        If EV_TYPE <> "" Then
            If dejaCondition Then
                Requete = Requete & "AND [EV_TYPE] LIKE '*" & EV_TYPE & "*' "
            Else
                Requete = Requete & "[EV_TYPE] LIKE '*" & EV_TYPE & "*' "
                dejaCondition = True
            End If
             End If
        If EV_SUB_TYPE <> "" Then
            If dejaCondition Then
                Requete = Requete & "AND [EV_SUB_TYPE] LIKE '*" & EV_SUB_TYPE & "*' "
            Else
                Requete = Requete & "[EV_SUB_TYPE] LIKE '*" & EV_SUB_TYPE & "*' "
                dejaCondition = True
            End If
             End If
        If EV_DATA <> "" Then
            If dejaCondition Then
                Requete = Requete & "AND [EV_DATA] LIKE '*" & EV_DATA & "*' "
            Else
                Requete = Requete & "[EV_DATA] LIKE '*" & EV_DATA & "*' "
                dejaCondition = True
            End If
             End If
        If EV_COMMENT <> "" Then
            If dejaCondition Then
                Requete = Requete & "AND [EV_COMMENT] LIKE '*" & EV_COMMENT & "*' "
            Else
                Requete = Requete & "[EV_COMMENT] LIKE '*" & EV_COMMENT & "*' "
                dejaCondition = True
            End If
             End If
        If OPERATOR_ID <> "" Then
            If dejaCondition Then
                Requete = Requete & "AND [OPERATOR_ID] = '" & OPERATOR_ID & "' "
            Else
                Requete = Requete & "[OPERATOR_ID] = '" & OPERATOR_ID & "' "
                dejaCondition = True
            End If
             End If
        If OPERATOR <> "" Then
            If dejaCondition Then
                Requete = Requete & "AND [OPERATOR] = '" & OPERATOR & "' "
            Else
                Requete = Requete & "[OPERATOR] = '" & OPERATOR & "' "
                dejaCondition = True
            End If
             End If
        If CREW_NUMBER <> "" Then
            If dejaCondition Then
                Requete = Requete & "AND [CREW_NUMBER] = '" & CREW_NUMBER & "' "
            Else
                Requete = Requete & "[CREW_NUMBER] = '" & CREW_NUMBER & "' "
                dejaCondition = True
            End If
             End If
        If WORKSHOP <> "" Then
            If dejaCondition Then
                Requete = Requete & "AND [WORKSHOP] LIKE '*" & WORKSHOP & "*' "
            Else
                Requete = Requete & "[WORKSHOP] LIKE '*" & WORKSHOP & "*' "
                dejaCondition = True
            End If
             End If
        If MACHINE_TYPE <> "" Then
            If dejaCondition Then
                Requete = Requete & "AND [MACHINE_TYPE] LIKE '*" & MACHINE_TYPE & "*' "
            Else
                Requete = Requete & "[MACHINE_TYPE] LIKE '*" & MACHINE_TYPE & "*' "
                dejaCondition = True
            End If
             End If
        If MACHINE_NO <> "" Then
            If dejaCondition Then
                Requete = Requete & "AND [MACHINE_NO] LIKE '*" & MACHINE_NO & "*' "
            Else
                Requete = Requete & "[MACHINE_NO] LIKE '*" & MACHINE_NO & "*' "
                dejaCondition = True
            End If
             End If
 
             If BARCODE <> "" Then
            If dejaCondition Then
                Requete = Requete & "AND [BARCODE] LIKE '*" & BARCODE & "*' "
            Else
                Requete = Requete & "[BARCODE] LIKE '*" & BARCODE & "*' "
                dejaCondition = True
            End If
             End If
        End If
Y no me funciona alguien me podria decir por que y q hacer para solucionarlo
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Buscador en access no me funciona

Publicado por tresy tresyuna@gmail.com (31 intervenciones) el 28/05/2016 00:52:25
Hola. Creo que la línea 54 debería ir a continuación del código escrito en la 55.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar