SQL 'LIKE' not working in Access?

Anonymous
2021-08-22T13:50:00+00:00

I have an Access database with a table called Assets that contains (among other things) the following columns and items:

Item Description Acquired From


Towel Green Bath Towel Target

Towel Green Hand Towel Target

Towel Kitchen Towels 4-pack Target

Towel Blue Bath Towel KMart

Towel Blue Hand Towel KMart

I get the above list if I use the SQL statement

SELECT Item, Description, [Acquired From] FROM Assets WHERE Item = "Towel";

However, if I use the SQL statement

SELECT Item, Description, [Acquired From] FROM Assets WHERE Item = "Towel" AND Description LIKE "Blue*";

I get nothing back. I was expecting to get the two rows containing the word "Blue" in the Description column.

What gives?

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

Answer accepted by question author

George Hepworth 22,870 Reputation points Volunteer Moderator
2021-08-22T14:09:01+00:00

Another thing to eliminate would be whether there are hidden characters in your field. That could happen if you imported the data from another source.

Try this version of your SQL with a wild card in front and behind the parameter:

SELECT Item, Description, [Acquired From] FROM Assets WHERE Item = "Towel" AND Description LIKE "*Blue*";

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

4 additional answers

Sort by: Most helpful
  1. George Hepworth 22,870 Reputation points Volunteer Moderator
    2021-08-22T16:08:02+00:00

    It's one of two possibilities that I can think of (and possibly something else).

    First, there may be a space before the first word. In fact, when I set up a little test to check myself, I did that exact thing.

    Second, if this data was imported from another source it could have a space in front of the first word or it could be a non-printing character that the source program inserted. I've seen that in other imported files.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2021-08-22T15:40:42+00:00

    Description is not a lookup field. The suggestion below by GroverParkGeorge worked, but I don't see why there would be hidden characters there. The word "Blue" is the first word of the Description.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2021-08-22T15:39:33+00:00

    OK, that worked! Don't know why there would be "hidden" characters. The word "Blue" is the first word of the description.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2021-08-22T14:08:42+00:00

    There is no reason why that would not work if the values at the column positions are as you say, so there must be something else in play which is not apparent from your post.  Is the Description column a 'lookup field' for instance?

    Was this answer helpful?

    0 comments No comments