ayuda con filtro en un tdbgrid
Publicado por arturo (3 intervenciones) el 04/03/2009 00:22:51
miren estoy trabajando con un tdbgrid enlazado con un adodc y a mi grid le quiero meter filtros en el primer caso son los que son texto el segundo son fechas, bueno alcorrerlo me llena el grid pero al meterle el filtro me arroja este mensaje "error de compilacion no se puede encontrar el proyecto o la biblioteca" y me posisiona en el primer trim del getfilter . y no le encuentro el error si alguien me puede ayudar porfavor se lo agradeceria este es mi codigo:
Private Sub Form_Load()
Skin1.LoadSkin App.Path & "skinWeb-II.skn"
Skin1.ApplySkin Me.hWnd
Call columnas
End Sub
Private Sub DataGrid1_HeadClick(ByVal ColIndex As Integer)
If Adodc1.Recordset.Sort = Adodc1.Recordset(ColIndex).Name & " asc" Then
Adodc1.Recordset.Sort = Adodc1.Recordset(ColIndex).Name & " desc"
Else
Adodc1.Recordset.Sort = Adodc1.Recordset(ColIndex).Name & " asc"
End If
Call columnas
' Call sumas_nombre
End Sub
Private Sub DataGrid1_FilterChange()
On Error GoTo errhandler
Set cols = DataGrid1.Columns
Dim C As Integer
C = DataGrid1.col
DataGrid1.HoldFields
Adodc1.Recordset.Filter = getfilter()
' Call sumas_nombre
DataGrid1.col = C
DataGrid1.EditActive = True
Exit Sub
errhandler:
MsgBox Err.Source & " : " & vbCrLf & Err.Description
End Sub
Private Function getfilter() As String ' filtro sql en el ADODC
Dim tmp As String
Dim N As Integer
Dim cont As Integer
cont = 0
For Each col In cols
Select Case cont
Case 0, 1, 2, 3, 6
If Trim(col.FilterText) <> "" Then
N = N + 1
If N > 1 Then
tmp = tmp & " AND "
End If
tmp = tmp & col.DataField & " like '" & col.FilterText & "*'"
End If
Case 4, 5
If Len(col.FilterText) <> 10 Then
Else
If Trim(col.FilterText) <> "" Then
N = N + 1
If N > 1 Then
tmp = tmp & " AND "
End If
tmp = tmp & col.DataField & "=#" & col.FilterText & "#"
End If
End If
End Select
cont = cont + 1
Next col
getfilter = tmp
End Function
Private Sub Form_Load()
Skin1.LoadSkin App.Path & "skinWeb-II.skn"
Skin1.ApplySkin Me.hWnd
Call columnas
End Sub
Private Sub DataGrid1_HeadClick(ByVal ColIndex As Integer)
If Adodc1.Recordset.Sort = Adodc1.Recordset(ColIndex).Name & " asc" Then
Adodc1.Recordset.Sort = Adodc1.Recordset(ColIndex).Name & " desc"
Else
Adodc1.Recordset.Sort = Adodc1.Recordset(ColIndex).Name & " asc"
End If
Call columnas
' Call sumas_nombre
End Sub
Private Sub DataGrid1_FilterChange()
On Error GoTo errhandler
Set cols = DataGrid1.Columns
Dim C As Integer
C = DataGrid1.col
DataGrid1.HoldFields
Adodc1.Recordset.Filter = getfilter()
' Call sumas_nombre
DataGrid1.col = C
DataGrid1.EditActive = True
Exit Sub
errhandler:
MsgBox Err.Source & " : " & vbCrLf & Err.Description
End Sub
Private Function getfilter() As String ' filtro sql en el ADODC
Dim tmp As String
Dim N As Integer
Dim cont As Integer
cont = 0
For Each col In cols
Select Case cont
Case 0, 1, 2, 3, 6
If Trim(col.FilterText) <> "" Then
N = N + 1
If N > 1 Then
tmp = tmp & " AND "
End If
tmp = tmp & col.DataField & " like '" & col.FilterText & "*'"
End If
Case 4, 5
If Len(col.FilterText) <> 10 Then
Else
If Trim(col.FilterText) <> "" Then
N = N + 1
If N > 1 Then
tmp = tmp & " AND "
End If
tmp = tmp & col.DataField & "=#" & col.FilterText & "#"
End If
End If
End Select
cont = cont + 1
Next col
getfilter = tmp
End Function
Valora esta pregunta


0