Board index » delphi » Why don't LIKE queries work in MSAccess?

Why don't LIKE queries work in MSAccess?

Accessing tables and queries in MS Access isn't too problematic,
however I can't get a query like:
        select * from mytable where name like '*smit*'
to work at all.  I'm using the non-standard asterisk as a wild-card,
as is the norm with Access but it returns no data.  The same query
copied into Access itself works fine.

Does anyone have any suggestions please?

Rob
--------------------------------
email: Rob.Da...@unn.ac.uk
Web:   http://www.unn.ac.uk/~isu8

 

Re:Why don't LIKE queries work in MSAccess?


I had the reverse problem when I moved from VB/MSAccess to Delphi, DAO uses
'%' as the like wildcard expression instead of  '*'.

VB:
  SELECT * FROM INVENTORY WHERE ITEMDESC LIKE 'CAR%'.
DELPHI:
 SELECT * FROM INVENTORY WHERE ITEMDESC LIKE 'CAR*'

Hope this helps.

Quote
Rob Davis wrote in message <36711075.31469...@news.unn.ac.uk>...
>Accessing tables and queries in MS Access isn't too problematic,
>however I can't get a query like:
> select * from mytable where name like '*smit*'
>to work at all.  I'm using the non-standard asterisk as a wild-card,
>as is the norm with Access but it returns no data.  The same query
>copied into Access itself works fine.

>Does anyone have any suggestions please?

>Rob
>--------------------------------
>email: Rob.Da...@unn.ac.uk
>Web:   http://www.unn.ac.uk/~isu8

Re:Why don't LIKE queries work in MSAccess?


On Thu, 10 Dec 1998 18:24:21 GMT, Rob.Da...@unn.ac.uk (Rob Davis)
wrote:

Use a % sign
This is the standard sql format
not ms format

John

Quote
>Accessing tables and queries in MS Access isn't too problematic,
>however I can't get a query like:
>    select * from mytable where name like '*smit*'
>to work at all.  I'm using the non-standard asterisk as a wild-card,
>as is the norm with Access but it returns no data.  The same query
>copied into Access itself works fine.

>Does anyone have any suggestions please?

>Rob
>--------------------------------
>email: Rob.Da...@unn.ac.uk
>Web:   http://www.unn.ac.uk/~isu8

Other Threads