I am running a search function that works, but is limited in one of my fields.
If I want to search for "B", and search every title with an "B" in it (regardless of where the B is), it wont show. If I have a title that is labeled "BAC", it will not show if I search "B", unless I type "BAC".
Can someone assist?
Sample Code
If I want to search for "B", and search every title with an "B" in it (regardless of where the B is), it wont show. If I have a title that is labeled "BAC", it will not show if I search "B", unless I type "BAC".
Can someone assist?
Sample Code
Code:
Private Function AdvancedSeach() As Variant
Dim varWhere As Variant
Dim tmp As String
tmp = """"
varWhere = Null
'Title
If Me.Text240 > "" Then
varWhere = varWhere & "[MyField] like " & tmp & Me.Text240 & tmp & " AND "
End If
If IsNull(varWhere) Then
varWhere = ""
Else
varWhere = "WHERE " & varWhere
If Right(varWhere, 5) = " AND " Then
varWhere = Left(varWhere, Len(varWhere) - 5)
End If
End If
AdvancedSearch = varWhere
End Function