I'm using the following to builder a search criteria:
And then using this to set the filter:
This works great for searches where the wildcard follows the search criteria. However, no matter how I juggle it I cannot get the search to work for a contains criteria. ie
Can anyone point out where I am going wrong?
Thanks :)
Code:
Private Sub btnSearch_Click()
' Update the record source
Me.frmsubClients.Form.RecordSource = "SELECT * FROM qryClientData " & BuildFilter
' Requery the subform
Me.frmsubClients.Requery
End Sub
Code:
Private Function BuildFilter() As Variant
Dim Varwhere As Variant
If Me.Reference > "" Then
Varwhere = Varwhere & "[referencenumber] LIKE """ & Me.Reference & "*"" AND "
End If
Code:
If Me.Reference > "" Then
Varwhere = Varwhere & "[referencenumber] LIKE "*"" & Me.Reference & "*"" AND "
Thanks :)
Comment