Page 1 of 1

Searching in Access

Posted: Tue Oct 22, 2002 12:50 pm
by terji
I'm having a funny problem with a search function searching a Access 2000 database.

The problem is this SQL sentence:
$sql = "SELECT DISTINCTROW * FROM news WHERE ((news.title) Like '*" . $search . "*') ORDER BY news.title, news.author;";
It works fine when executed directly in Access but through the ODBC I just recieve an empty recordset. If I remove the [*] before and after the search criteria and type the exact title I get the results. Can't I use * via ODBC?

Can anyone help me with this?

Posted: Fri Oct 25, 2002 7:17 am
by smesquita
In access by ODBC I always use % insted of *:

like '%word%'

Try it :!:

What about indexing??????

Posted: Sun Nov 03, 2002 9:56 am
by terji
If I create an index in the DB to speed up searches, do I then have to change my search sql sentence :?:

Posted: Mon Nov 04, 2002 11:22 am
by smesquita
No. If you create an index, the conceptual data will not be changed, only the way the data is stored in files are changed (to speed up the search)