Visual Basic - ERROR EN FILTROS

Life is soft - evento anual de software empresarial
 
Vista:

ERROR EN FILTROS

Publicado por OSCAR (1 intervención) el 27/04/2015 22:46:32
NECESITO AYUDA EN MIS FILTROS MI PRIMER FILTRO FUNCIONA Y CUMPLE SU FUNCIÓN PERFECTAMENTE PERO CUANDO LO HAGO EN OTROS FORMULARIOS ME PONE ERROR EN FILTRO PERO USO EL MISMO YA CAMBIE VARIABLES Y EL NOMBRE DE LOS OBJETOS PERO ME SIGUE MARCANDO EL MIMO ERROR AGRADEZCO MUCHO SU AYUDA Y SU ATENCION POR LEER MI PROBLEMA

ESTE ES MI PRIMER 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
Private Sub Command2_Click()
With Adodc1
If Text1 <> "" Then
.Recordset.Filter = XXX & " LIKE '*" + Text1 + "*'"
Set DataReport1.DataSource = DataGrid1.DataSource
 
DataReport1.WindowState = 2
DataReport1.Orientation = rptOrientLandscape
DataReport1.TopMargin = 0
DataReport1.BottomMargin = 0
DataReport1.LeftMargin = 0
DataReport1.RightMargin = 0
Else
Set DataReport1.DataSource = DataGrid1.DataSource
 
DataReport1.WindowState = 2
DataReport1.Orientation = rptOrientLandscape
DataReport1.TopMargin = 0
DataReport1.BottomMargin = 0
DataReport1.LeftMargin = 0
DataReport1.RightMargin = 0
 
End If
DataReport1.Show
End With
End Sub
 
Private Sub DataGrid1_Click()
Row = DataGrid1.Row
COD = DataGrid1.Columns(0).Value
End Sub
 
Private Sub Form_Load()
Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
Adodc1.ConnectionString = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;" & "DATA SOURCE=" & App.Path & "\MANTE.mdb"
Adodc1.CursorType = adOpenDynamic
Adodc1.RecordSource = "LISTADOE"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1.Recordset
 
With Adodc1
XXX = "INVENTARIO"
End With
End Sub
 
Private Sub Text1_Change()
If Option1 = True Then
XXX = "INVENTARIO"
ElseIf Option2 = True Then
XXX = "SERIE"
ElseIf Option3 = True Then
XXX = "DESCRIPCION"
End If
With Adodc1
If Text1 <> "" Then
   .Recordset.Filter = XXX & " LIKE '*" + Text1 + "*'"
   Set DataGrid1.DataSource = Adodc1.Recordset
   Else
   .RecordSource = "SELECT * FROM LISTADOE"
   Set DataGrid1.DataSource = Adodc1.Recordset
   End If
   .Refresh
   End With
   Exit Sub
End Sub
 
ESTE ES EL SEGUNDO
 
Private Sub Command2_Click()
With Adodc2
If Text1 <> "" Then
.Recordset.Filter = XXX & " LIKE '*" + Text1 + "*'"
Set DataReport2.DataSource = DataGrid1.DataSource
 
DataReport2.WindowState = 2
DataReport2.Orientation = rptOrientLandscape
DataReport2.TopMargin = 0
DataReport2.BottomMargin = 0
DataReport2.LeftMargin = 0
DataReport2.RightMargin = 0
Else
Set DataReport2.DataSource = DataGrid1.DataSource
 
DataReport2.WindowState = 2
DataReport2.Orientation = rptOrientLandscape
DataReport2.TopMargin = 0
DataReport2.BottomMargin = 0
DataReport2.LeftMargin = 0
DataReport2.RightMargin = 0
 
End If
DataReport2.Show
End With
End Sub
Private Sub DataGrid1_Click()
Row = DataGrid1.Row
COD = DataGrid1.Columns(0).Value
End Sub
 
Private Sub Form_Load()
Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
Adodc2.ConnectionString = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;" & "DATA SOURCE=" & App.Path & "\MANTE.mdb"
Adodc2.CursorType = adOpenDynamic
Adodc2.RecordSource = "ALTAR"
Adodc2.Refresh
Set DataGrid1.DataSource = Adodc2.Recordset
 
With Adodc2
YYY = "IdREPORTE"
End With
 
End Sub
 
Private Sub Text2_Change()
With Adodc2
If Text2 <> "" Then
   .Recordset.Filter = YYY & " LIKE '*" + Text1 + "*'" ' AQUI ME MARCA EL ERROR
   Set DataGrid1.DataSource = Adodc2.Recordset
   Else
   .RecordSource = "SELECT * FROM ALTAR"
   Set DataGrid1.DataSource = Adodc2.Recordset
   End If
   .Refresh
   End With
End Sub
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