ACC: Running Stored Access Queries with Wildcards via ODBC May Return Incorrect Results
ID: Q234525
|
The information in this article applies to:
-
Microsoft Access versions 2.0, 7.0, 97
-
Microsoft Data Access Components version 2.1 (GA)
Moderate: Requires basic macro, coding, and interoperability skills.
SYMPTOMS
In a Microsoft Access Jet 3.5x or earlier database, you have a stored query that uses a valid Jet wildcard character, but when you run it, no records are returned, even though you are certain there are matching records.
CAUSE
You have the Microsoft Access ODBC driver version 4.0 or later and Microsoft Jet OLE DB Provider version 4.0 or later installed.
STATUS
This is the designed behavior when you are using the Microsoft Access ODBC driver version 4.0 or later and Microsoft Jet OLE DB Provider version 4.0 or later and Jet 4.x.
The Microsoft Jet database engine is generally ANSI-89 Level 1 compliant. However, certain ANSI SQL features are not implemented in Microsoft Jet SQL. With the release of Microsoft Jet version 4.x, the Microsoft Access ODBC driver, and Microsoft OLE DB Provider for Jet 4.x, Microsoft Jet SQL exposes more ANSI-92 SQL syntax. Conversely, Microsoft Jet SQL includes reserved words and features not supported in ANSI SQL.
Microsoft Jet SQL supports both ANSI SQL wildcard characters and Microsoft Jet-specific wildcard characters to be used with the LIKE operator. The use of the ANSI and Microsoft Jet wildcard characters is mutually exclusive. You must use one set or the other, and you cannot mix them. The ANSI SQL wildcards are only available when you are using Jet 4.x and the Microsoft OLE DB Provider for Jet and the Microsoft Access ODBC Driver. If you try using the ANSI SQL wildcards through Microsoft Access or Data Access Object (DAO), they are interpreted as literals. The opposite is true when you are using the Microsoft OLE DB Provider for Jet or the Microsoft Access ODBC driver and Jet 4.x
MORE INFORMATION
Steps to Reproduce Behavior
-
Install either MDAC 2.1 or a Microsoft Office 2000 suite (to install Jet 4.x).
-
Create a data source to the sample database Northwind.mdb.
-
Open MSQuery and create a new query with the data source for Northwind.
-
In SQL View, type the following line:
SELECT * FROM Customers WHERE CustomerID LIKE 'a*'
-
Run the query. Note that no records are returned.
Using the Microsoft Access ODBC driver and Jet Provider that is included with MDAC 2.0, the query would return all of the customer records with a CustomerID that starts with "A".
Additional query words:
pra acc97 acc2 acc95
Keywords : kbdta
Version : WINDOWS:2.0,2.1 (GA),7.0,97
Platform : WINDOWS
Issue type : kbbug