Reputation: 4472
I have a table in mdb with field address, which will contain street address e.t.c as string. I want to be able to search part of this record.
sCriteria = "address like " & "'" & streetAddr & "'"
Rs1.Filter = sCriteria
it searches for e.g "Mall" while there is a record "Mall Road" which should have been found but is not as Road is missing, what should i do to make part of field searchable
Upvotes: 0
Views: 6449
Reputation: 11991
Try
sCriteria = "address like '*" & Quote(streetAddr) & "*'"
where Quote
does a simple Replace(sText, "'", "''")
Upvotes: 3
Reputation: 10001
Put an '*' before the closing single-quote, after the filter value.
Upvotes: 0