M
michaelg51
Hi all, I'm hoping for an answer to search form that's been puzzling me for a
few weeks now. I'm trying to make a search form where users can enter
multiple criteria to search through a number of fields in a table.
I dl'd a demo that seemed to do exactly what I want
(http://allenbrowne.com/ser-62.html) but I keep getting prompted to enter a
parameter(like in a parameter query) even though there is no query that is
being called anywhere in the code. I tried commenting out everything
unnecessary and searching on only one field with no change.
Below is the code that I've modified, I'm getting prompted for the parameter
between 'Me.Filter = strWhere' and 'Me.FilterOn = True'
Private Sub cmdSearch_Click()
Dim strWhere As String
Dim lngLen As Long
'Const conJetdate = "\#mm\/dd\/yyyy\#"
'If Not IsNull(Me.txtIRsrch) Then
' strWhere = strWhere & "([IR] = """ & Me.txtIRsrch & """) and "
'End If
If Not IsNull(Me.txtDeptsrch) Then
strWhere = strWhere & "([Department] = """ & Me.txtDeptsrch & """)"
'and "
End If
'If Not IsNull(Me.txtSYSsrch) Then
' strWhere = strWhere & "([System] = """ & Me.txtSYSsrch & """) and "
'End If
'If Not IsNull(Me.txtDESCsrch) Then
' strWhere = strWhere & "([Description] like ""*" & Me.txtDESCsrch &
"*"") and "
'End If
'Trim trailing characters(" and ")
'Trim trailing characters(", ")
lngLen = Len(strWhere) - 5
'If lngLen <= 0 Then 'no trailing characters
' MsgBox "No Search criteria entered Dolt!", vbInformation, "Nothing
here, move along."
'Else
' strWhere = Left$(strWhere, lngLen) 'trim trailing characters
Debug.Print strWhere
Me.Filter = strWhere
Me.FilterOn = True
'End If
End Sub
Any help at all would be appreciated,
Thanks!
few weeks now. I'm trying to make a search form where users can enter
multiple criteria to search through a number of fields in a table.
I dl'd a demo that seemed to do exactly what I want
(http://allenbrowne.com/ser-62.html) but I keep getting prompted to enter a
parameter(like in a parameter query) even though there is no query that is
being called anywhere in the code. I tried commenting out everything
unnecessary and searching on only one field with no change.
Below is the code that I've modified, I'm getting prompted for the parameter
between 'Me.Filter = strWhere' and 'Me.FilterOn = True'
Private Sub cmdSearch_Click()
Dim strWhere As String
Dim lngLen As Long
'Const conJetdate = "\#mm\/dd\/yyyy\#"
'If Not IsNull(Me.txtIRsrch) Then
' strWhere = strWhere & "([IR] = """ & Me.txtIRsrch & """) and "
'End If
If Not IsNull(Me.txtDeptsrch) Then
strWhere = strWhere & "([Department] = """ & Me.txtDeptsrch & """)"
'and "
End If
'If Not IsNull(Me.txtSYSsrch) Then
' strWhere = strWhere & "([System] = """ & Me.txtSYSsrch & """) and "
'End If
'If Not IsNull(Me.txtDESCsrch) Then
' strWhere = strWhere & "([Description] like ""*" & Me.txtDESCsrch &
"*"") and "
'End If
'Trim trailing characters(" and ")
'Trim trailing characters(", ")
lngLen = Len(strWhere) - 5
'If lngLen <= 0 Then 'no trailing characters
' MsgBox "No Search criteria entered Dolt!", vbInformation, "Nothing
here, move along."
'Else
' strWhere = Left$(strWhere, lngLen) 'trim trailing characters
Debug.Print strWhere
Me.Filter = strWhere
Me.FilterOn = True
'End If
End Sub
Any help at all would be appreciated,
Thanks!