i need search "fuzzy matches" in database when searching surname. have implemented following function enable soundex function, has no issues.
i getting issues when comes building sql search through database calling soundex function on fly. know vba functions can called in sql statements, yet doesn't seem working properly.
private sub cmdsearch_click() dim lsql string dim lsearchstring string if len(txtsearchstring) = 0 or isnull(txtsearchstring) = true msgbox "you must enter search string." else lsearchstring = txtsearchstring lsql = "select * tvictim " lsql = lsql & "where soundex([victim surname]) = " & soundex(lsearchstring) & ";" frmvictim.form.recordsource = lsql lbltitle.caption = "matching victim details: filtered '" & lsearchstring & "'" txtsearchstring = "" msgbox "results have been filtered. victim names containing " & lsearchstring & "." end if end sub
when enter string on form , click button, have stepped through, , @ point builds sql, throws command window soundex output of text in search box, , box data entry.
been fiddling while , can't seem find example helps.
i'm using allen browne's soundex function access 2003: soundex - fuzzy matches
it returns soundex value string. if soundex function you're using returns string, enclose soundex(lsearchstring) quotes database engine recognizes string value instead of name of missing parameter.
lsql = lsql & "where soundex([victim surname]) = '" & soundex(lsearchstring) & "';"
Comments
Post a Comment