S
sebastico
Hello
I have been trying to get a Form to search in a Access 2003 db based in
allenbrowne SearchForm. The fields are one table:
ObraID(String)
Año(String)
AutNomb(String)
Titulo(String)
Resumen(Memo)
Nevertheless, on clicking the "filter" the db displays in
(Me.txtFilterResumen) : "Compile
error:Method or data member not found".
Due to this error, I don't know if all code is correct and I need to run it.
Could you help
me to fix this error?
My code is:
Option Compare Database
Option Explicit
Private Sub cmdFilter_Click()
Dim strWhere As String
Dim lngLen As Long
If Not IsNull(Me.txtFilterObraID) Then
strWhere = strWhere & "([ObraID] = """ & Me.txtFilterObraID & """) AND "
End If
If Not IsNull(Me.txtFilterAño) Then
strWhere = strWhere & "([Año] = """ & Me.txtFilterAño & """) AND "
End If
If Not IsNull(Me.txtFilterAutNomb) Then
strWhere = strWhere & "([AutNomb] Like ""*" & Me.txtFilterAutNomb & """)
AND "
End If
If Not IsNull(Me.txtFilterTitulo) Then
strWhere = strWhere & "([Titulo] Like """ & Me.txtFilterTitulo & """)
AND "
End If
If Not IsNull(Me.txtFilterResumen) Then
strWhere = strWhere & "([Resumen] = """ & Me.txtFilterResumen & """) AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "Sin criterio", vbInformation, "Nada que hacer."
Else
strWhere = Left$(strWhere, lngLen)
(Ctrl+G).
'Debug.Print strWhere
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub
Private Sub cmdReset_Click()
Dim ctl As Control
For Each ctl In Me.Section(acHeader).Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox
ctl.Value = Null
Case acCheckBox
ctl.Value = False
End Select
Next
Me.FilterOn = False
End Sub
Private Sub Form_BeforeInsert(Cancel As Integer)
Cancel = True
MsgBox "Usted no puede agregar nuevos autores al formulario de
búsqueda.", vbInformation, "Permiso denegado."
End Sub
Private Sub Form_Open(Cancel As Integer)
'Me.Filter = "(False)"
'Me.FilterOn = True
End Sub
Many thanks
I have been trying to get a Form to search in a Access 2003 db based in
allenbrowne SearchForm. The fields are one table:
ObraID(String)
Año(String)
AutNomb(String)
Titulo(String)
Resumen(Memo)
Nevertheless, on clicking the "filter" the db displays in
(Me.txtFilterResumen) : "Compile
error:Method or data member not found".
Due to this error, I don't know if all code is correct and I need to run it.
Could you help
me to fix this error?
My code is:
Option Compare Database
Option Explicit
Private Sub cmdFilter_Click()
Dim strWhere As String
Dim lngLen As Long
If Not IsNull(Me.txtFilterObraID) Then
strWhere = strWhere & "([ObraID] = """ & Me.txtFilterObraID & """) AND "
End If
If Not IsNull(Me.txtFilterAño) Then
strWhere = strWhere & "([Año] = """ & Me.txtFilterAño & """) AND "
End If
If Not IsNull(Me.txtFilterAutNomb) Then
strWhere = strWhere & "([AutNomb] Like ""*" & Me.txtFilterAutNomb & """)
AND "
End If
If Not IsNull(Me.txtFilterTitulo) Then
strWhere = strWhere & "([Titulo] Like """ & Me.txtFilterTitulo & """)
AND "
End If
If Not IsNull(Me.txtFilterResumen) Then
strWhere = strWhere & "([Resumen] = """ & Me.txtFilterResumen & """) AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "Sin criterio", vbInformation, "Nada que hacer."
Else
strWhere = Left$(strWhere, lngLen)
(Ctrl+G).
'Debug.Print strWhere
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub
Private Sub cmdReset_Click()
Dim ctl As Control
For Each ctl In Me.Section(acHeader).Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox
ctl.Value = Null
Case acCheckBox
ctl.Value = False
End Select
Next
Me.FilterOn = False
End Sub
Private Sub Form_BeforeInsert(Cancel As Integer)
Cancel = True
MsgBox "Usted no puede agregar nuevos autores al formulario de
búsqueda.", vbInformation, "Permiso denegado."
End Sub
Private Sub Form_Open(Cancel As Integer)
'Me.Filter = "(False)"
'Me.FilterOn = True
End Sub
Many thanks