Microsoft KB Archive/282604

= ACC2000: Microsoft Jet Does Not Pass WHERE Clause to ODBC Data Source =

Article ID: 282604

Article Last Modified on 1/26/2005

-

APPLIES TO


 * Microsoft Access 2000 Service Pack 1
 * Microsoft Data Access Components 2.6

-



This article was previously published under Q282604



Advanced: Requires expert coding, interoperability, and multiuser skills.

This article applies only to a Microsoft Access database (.mdb).



SYMPTOMS
When you use Access 2000 Service Release 1 (SR-1) with Microsoft Jet 4.0 Service Pack 5 (SP5) to query tables linked from two separate databases on the same server, you may find that Jet does not pass the WHERE clause parameters to the ODBC data source when both of the following are true:
 * The query creates a join between the two tables.
 * The query contains a WHERE clause that uses both the OR and the AND operators.

You may find that query performance is extremely slow when you query large sets of data under these conditions. Saving the password when you link the tables may or may not affect performance. This only affects Msjet40.dll version 4.0.4431.x



CAUSE
Jet does not send the WHERE clause for one or for both queried tables. This causes the server to return all rows to the client.



RESOLUTION
To resolve this problem, install the latest Jet 4.0 service pack. For additional information about how to obtain and how to install the latest Jet 4.0 service pack, click the following article number to view the article in the Microsoft Knowledge Base:

239114 How To: Obtain the Latest Service Pack for the Microsoft Jet 4.0 Database Engine



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first fixed in Jet 4.0 Service Pack 6 (SP6).



Steps to Reproduce the Behavior
 On a computer that is running Microsoft SQL Server 7.0, use Enterprise Manager to create a new database called pubs2. Open Enterprise Manager. Expand the server group for the local server. Right-click Databases, and then select the option to create a new database (accept all defaults). Change the new database name to pubs2, and then close the dialog box.</li> Copy the Authors table from pubs to pubs2, either by using Enterprise Manager or by executing the following SELECT statement in Query Analyzer:

SELECT * INTO pubs2..authors FROM pubs..authors

</li> Create a new database in Access called Test.mdb .</li> Create a new system DSN TestPubs to SQL 7.0 server. Change the default database to pubs and supply a valid userid and password.</li> Create a new system DSN TestPubs2 to SQL 7.0 server. Change the default database to pubs2 and supply a valid userid and password.</li> Link pubs.titleauthor to Test.mdb by using &quot;TestPubs.&quot; Do not save the password.</li> Link pubs2.authors to Test.mdb by using &quot;TestPubs2.&quot; Do not save the password.</li> Create the following new query in Design view in Test.mdb:

SELECT dbo_authors.au_id, dbo_authors.au_lname, dbo_titleauthor.title_id

FROM dbo_authors INNER JOIN dbo_titleauthor ON dbo_authors.au_id = dbo_titleauthor.au_id

WHERE (dbo_authors.au_lname = &quot;Ringer&quot; AND dbo_titleauthor.title_id = &quot;PS2106&quot;) OR dbo_authors.au_lname = &quot;White&quot;

</li> Save the query as qSel2Authors .</li> Quit Access.</li> Start tracing from the ODBC Data Sources tool in Control Panel.</li> Open Test.mdb, and then execute qSel2Authors.</li> Quit Access.</li> Stop tracing in the ODBC Data Sources tool in Control Panel.</li> Open the trace log in Microsoft Word 2000.</li> Search for au_id in the trace log.

Note the SELECT statement sent and records returned.</li> <li>Search for title_id in the trace log.

Note the SELECT statement sent and records returned.</li></ol>

Additional query words: prb

Keywords: kbbug kbfix KB282604

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.