开发者

Find a part of field using ADODB.Recordset in vb6

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开发者_如何学Python been found but is not as Road is missing, what should i do to make part of field searchable


Try

sCriteria = "address like '*" & Quote(streetAddr) & "*'"

where Quote does a simple Replace(sText, "'", "''")


Put an '*' before the closing single-quote, after the filter value.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜