Private Sub cmdSearchFaults_Click()
Dim strDescription As String
Dim strCriteria As String
Dim strFilter As String
Dim strQuote As String
strQuote = Chr(34)
''' FaultDescription is a text field with 255 chr max length
strDescription = Me.FaultDescription
strCriteria = InputBox("Enter search word.")
''' search evaluates FaultDescription to see if it contains strCriteria
''' if so it returns the contents of fault description thus evaluating to true
''' if not it returns a zero lenth string "" evaluating to false
''' however it does not seem as though it evaluates the function for each record as the filter is applied
strFilter = strQuote & "[FaultDescription] = " & "'" & Search(strDescription, strCriteria) & "'" & strQuote
Me.Filter = strFilter
Me.FilterOn = True
End Sub
Public Function Search(Text, Word) As String
If InStr(1, Text, Word, 1) > 0 Then
Search = Text
Else: Search = ""
End If
End Function