no syntax error error as such - it you are saying this is what you want the code to do
i
f i type keyword: "JAVA" it will shows any keyword related "JAVA"
you are not using wildcards which you require for this statement to work, and have some code which is never used
you also don't need the tmp variable, just use '
varwhere will never be null because you are assign it "ID like " etc
and as you have constructed it, varwhere will never end in ' AND '
Also helps if you learn to use indenting - makes your code easier to read and debug. try
Code:
Private Function BuildFilter() As String
Dim varWhere As String
If Nz(Me.txtSearch, "") <> "" Then
varWhere = "WHERE [ID] like '*" & Me.txtSearch & "*' OR [Membership_ID] Like '*" & Me.txtSearch & "*' OR [Membership_name] Like '*" & Me.txtSearch & "*' OR [Book_ID] Like '*" & Me.txtSearch & "*' OR [Book_Name] Like '*" & Me.txtSearch & "*' OR [Book_location] Like '*" & Me.txtSearch & "*'"
Else
varWhere = ""
End If
BuildFilter = varWhere
End Function