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. Anonymous
    2013-03-25T12:29:06+00:00

    Thanx again HansV,

    No doubt u guys remain to be my ideals! Following modification in VBA did work out perfectly:

    Private Sub Text56_Change()

    If Text56.Text = "" Then

    Text56.Text = "<<Enter Pattern To Find>>"

    Text56.SelLength = Len(Text56.Text)

    End If

    If Text56.Text = "<<Enter Pattern To Find>>" Or Text56.Text = "" Then

    Me.ClientsList.RowSource = "SELECT [01_Clients].Customer FROM 01_Clients ORDER BY [01_Clients].Customer"

    Else

    Me.ClientsList.RowSource = "SELECT [01_Clients].Customer FROM 01_Clients WHERE [01_Clients].Customer Like " & Chr(34) & Replace(Me.Text56.Text, "*", "%") & Chr(34) & " ORDER BY [01_Clients].Customer"

    End If

    End Sub

    0 comments No comments