Access 2007 LIKE Expression

K

kpick4

I am converting an Oracle database to Access. When recreating my queries I
cannot figure out the syntax for the LIKE expression.

Oracle:
SELECT ORDNUM, CUST_LNAME, SALE_DATE
FROM ORDERS
WHERE UPDATED_BY LIKE '%APRIL%';

Access:
SELECT orders.ORDNUM, orders.CUST_LNAME, orders.SALE_DATE
FROM orders
WHERE (((orders.UPDATED_BY) like "% APRIL %"));

I have hacked the syntax in every way I can think of using information from
various posts on this web site but it always returns zero rows. No errors,
but no data either. I have verified the data is in the table. Microsoft
says to use the % symbol instead of the * for Access 2007.
 
K

Ken Snell \(MVP\)

ACE (ACCESS 2007 database engine) uses * as the wildcard character instead
of %.

SELECT orders.ORDNUM, orders.CUST_LNAME, orders.SALE_DATE
FROM orders
WHERE (((orders.UPDATED_BY) Like "* APRIL *"));
 
K

kpick4

Thanks. I tried the * also with no success.
ACE (ACCESS 2007 database engine) uses * as the wildcard character instead
of %.

SELECT orders.ORDNUM, orders.CUST_LNAME, orders.SALE_DATE
FROM orders
WHERE (((orders.UPDATED_BY) Like "* APRIL *"));
I am converting an Oracle database to Access. When recreating my queries I
cannot figure out the syntax for the LIKE expression.
[quoted text clipped - 15 lines]
but no data either. I have verified the data is in the table. Microsoft
says to use the % symbol instead of the * for Access 2007.
 
T

Tom Lake

kpick4 said:
Thanks. I tried the * also with no success.


Is APRIL the first name of an employee? If the format is like this:
APRIL JONES then get rid of the space between * and APRIL in the test
since there's no space in front of APRIL in the table.

WHERE (((orders.UPDATED_BY) Like "*APRIL *"));

If the format is JONES, APRIL then get rid of the space between APRIL and *.

WHERE (((orders.UPDATED_BY) Like "* APRIL*"));


Tom Lake
 
K

kpick4

Bingo !!!!! Thanks !!!!!!!

Tom said:
Thanks. I tried the * also with no success.
[quoted text clipped - 4 lines]
Is APRIL the first name of an employee? If the format is like this:
APRIL JONES then get rid of the space between * and APRIL in the test
since there's no space in front of APRIL in the table.

WHERE (((orders.UPDATED_BY) Like "*APRIL *"));

If the format is JONES, APRIL then get rid of the space between APRIL and *.

WHERE (((orders.UPDATED_BY) Like "* APRIL*"));

Tom Lake
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top