Refrescar un datagrid
Publicado por Ale (47 intervenciones) el 28/10/2010 03:22:31
Hola a todos tengo la siguiente estructura en un form de consulta, la cual funciona sin problemas al momento de escribir algo en el text1 , el problema es que al dejar el blanco el text1 el datagrid no me muestra los registros, es decir no hace el refresf del datagrid..
Que me falta o que tengo mal ????
Dim consulta As String
Private Sub Form_Load()
Set DataGrid1.DataSource = Adodc1.Recordset
Adodc1.Refresh
Adodc1.RecordSource = "Ingreso5"
End Sub
Private Sub Text1_Change()
If Op1 = True Then
consulta = "Nombre"
ElseIf Op2 = True Then
consulta = "empresa"
End If
With Adodc1
If Text1 <> "" Then
.Recordset.Filter = consulta & " Like '*" + Text1 + "*'"
Set DataGrid1.DataSource = Adodc1.Recordset
Else
.Recordset.Filter = ""
End If
.Refresh
End With
End Sub
Que me falta o que tengo mal ????
Dim consulta As String
Private Sub Form_Load()
Set DataGrid1.DataSource = Adodc1.Recordset
Adodc1.Refresh
Adodc1.RecordSource = "Ingreso5"
End Sub
Private Sub Text1_Change()
If Op1 = True Then
consulta = "Nombre"
ElseIf Op2 = True Then
consulta = "empresa"
End If
With Adodc1
If Text1 <> "" Then
.Recordset.Filter = consulta & " Like '*" + Text1 + "*'"
Set DataGrid1.DataSource = Adodc1.Recordset
Else
.Recordset.Filter = ""
End If
.Refresh
End With
End Sub
Valora esta pregunta


0