LIKE Operator not working in a query

Anonymous
2013-03-25T10:17:23+00:00

The following query returns the full list of customers if I remove the WHERE... LIKE clause. While expecting the entries starting with "A" from the same what could be the error leading to a blank single cell?

SELECT [01_Clients].Customer

FROM 01_Clients

WHERE ((([01_Clients].[Customer]) LIKE "A*"));

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes
Answer accepted by question author
  1. HansV 462.3K Reputation points MVP Volunteer Moderator
    2013-03-25T12:24:33+00:00

    Access supports two dialects of SQL: Access SQL and ANSI-92 SQL. The latter is compatible with SQL Server; it uses % as wildcard for any number of characters, and _ for a single character, instead of * and ? respectively.

    You can specify the version to use in File > Options > Object Designers > SQL Server Compatible Syntax (ANSI 92) in the Query design section.

    1 person found this answer helpful.
    0 comments No comments

5 additional answers

Sort by: Most helpful
  1. HansV 462.3K Reputation points MVP Volunteer Moderator
    2013-03-25T11:01:02+00:00

    The SQL looks correct!

    Are you sure that there are customers whose name starts with A?

    0 comments No comments
  2. Anonymous
    2013-03-25T11:11:02+00:00

    Sure the entries do exist. But even a query like:

    SELECT [01_Clients].Customer

    FROM 01_Clients

    WHERE ((([01_Clients].Customer) Like "*"));

    doesn't work, while inserting the whole name as:

    SELECT [01_Clients].Customer

    FROM 01_Clients

    WHERE ((([01_Clients].Customer) Like "A. Venture"));

    does return a single record pertaining to **"**A. Venture"

    0 comments No comments
  3. HansV 462.3K Reputation points MVP Volunteer Moderator
    2013-03-25T11:15:51+00:00

    What happens if you use % as wildcard instead of * ?

    0 comments No comments
  4. Anonymous
    2013-03-25T11:48:41+00:00

    U R right! % does work correctly! By the way any reason?

    0 comments No comments