Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Querying a Access DB with SQL

Author  Topic 

DavidMorgan
Starting Member

5 Posts

Posted - 2002-05-29 : 04:53:23
Hi,

I am using a Visual Basic front end that is hooked up to a Access Database (.MDB), I am using SQL statements to querry that database only. The simple queries that I have used work fine but now I am attempting to create a query that will search for a keyword in a field that has a whole string of words. What I have is a address field and a city field, I have the SQL query working fine for the search for the city, it is a extension saying "AND dep_city = 'Lincoln' "

The problem is that the address field could be filled with a string of words such as below:
36 Bishops Drive, Welton, West Side

I need the search to look for one word from that field, such as Welton, or even Bishops. I have been given a SQL statement that goes like this: "AND address LIKE '%Welton%'" but this does not work although it should do in theory, at least on SQL Server, but not for Access?

Anyhelp you could give me would be much appreciated.

Thanks a lot, David




Edited by - DavidMorgan on 05/29/2002 08:51:57

joldham
Wiseass Yak Posting Master

300 Posts

Posted - 2002-05-29 : 07:57:40
David,

Again, Please do not cross post.

http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=16275



Go to Top of Page

astanchie
Starting Member

1 Post

Posted - 2002-06-06 : 11:17:39
I think access uses * as a wildcard where as
sql uses %
Go to Top of Page

patrickh
Starting Member

2 Posts

Posted - 2002-06-06 : 12:08:50
That is correct, * is the wildcard in Access.

Go to Top of Page

Doug G
Constraint Violating Yak Guru

331 Posts

Posted - 2002-06-07 : 00:38:17
If you are connecting with ADO, the % wildcard should work correctly.


======
Doug G
======
Go to Top of Page
   

- Advertisement -