PDA

Click to See Complete Forum and Search --> : Searching


AcornRanch
Mar 20th, 2000, 07:47 PM
I currently am working on a database program and would like to know how to search text fields to find close matches. I currently have the program to exact mactches but I would like I broader search to find exact and simlar matches. Any suggestions??


~Jeremy

Ishamel
Mar 20th, 2000, 08:21 PM
I think this is what you are after.

This code, will return all the records that have 'ABC' anywhere within the data field.


mySearchString = "ABC"

Set myResultSet = myCon.OpenResultSet("Select myField From myTable Where UPPER(myField) Like UPPER('%" & mySearchString & "%')")

'Now you can start looping through all the records
'that contain 'ABC' within their text.


This SQL statement is for searching an SQL Server database, so you might have to alter it slightly if you are wanting to search another type of database.
The help files should tell you what wildcard to use instead of the % symbol.

(The UPPER ysntax is optional. I've used it to remove any case sensitive issues.)

Hope this helps. :)

[Edited by Ishamel on 03-21-2000 at 09:22 AM]

hkmai
Apr 19th, 2000, 01:28 AM
It works!! Thanks Ishamel:)