Microsoft KB Archive/271661

= ACC2000: Query Returns no Records with an Indexed Field That Contains Dashes =

Article ID: 271661

Article Last Modified on 6/29/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q271661





Novice: Requires knowledge of the user interface on single-user computers.

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



SYMPTOMS
When you run a query against data that contains dashes, and you are using the LIKE operator as criteria in the query, no rows are returned.



CAUSE
The field that contains the dashes is indexed. The LIKE operator does not work for this field in this case.



RESOLUTION
The following updates are required:  You must obtain the latest Microsoft Jet 4.0 service pack that contains an updated version of the Microsoft Jet 4.0 database engine. For additional information about how to obtain Microsoft Jet 4.0, 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

 You must also install one of the following to obtain the updated mswdat10.dll and mswstr10.dll files that are version 4.0.3829.2 or later:  Install Microsoft Data Access Components MDAC 2.5 SP1 (GA). You can download MDAC 2.5 SP1 (GA) from the following Microsoft Web site: http://msdn.microsoft.com/dataaccess Obtain Microsoft Windows 2000 Service Pack 1 (Win 2000 SP1). For information about downloading SP1 or obtaining the Windows 2000 SP1 CD, please visit the following Microsoft Web site: http://www.microsoft.com/windows2000/ Install Microsoft SQL Server 2000. For information about SQL Server 2000, please visit the following Microsoft Web site: http://www.microsoft.com/sql/</li></ul> </li></ol>

<div class="status_section">

STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

<div class="moreinformation_section">

Steps to Reproduce the Behavior
<ol> Create a new Access 2000 database.</li> Create a table named Table1 that has a single Text field named Field1.</li> Add an index to the Field1 field.</li> Switch the Table1 table to Datasheet view.</li>  Add the following data to the Field1 field: <pre class="fixed_text">  g2-1-40 g2-1-41 g2-1-42 g2-1-43 g2-1-44 </li> Close and save the table.</li> On the Insert menu, click Query. Click OK in the New Query dialog box to open the Query Designer. Close the Show Tables dialog box without adding any tables.</li> In the Query Designer, click SQL View on the View menu.</li>  Type the following into the SQL view: <pre class="fixed_text">  SELECT Table1.field1 FROM Table1 WHERE (((Table1.field1) Like &quot;g2-1*&quot;)); </li> Run the query. Note that no rows are returned.</li> Close and save the query as Query1.</li> Open the Table1 table in Design view, and then remove the index from the Field1 field.</li> Close and save the table.</li> Run the Query1 query again. Note that now the correct rows are returned.</li></ol>

Additional query words: pra hyphens

Keywords: kbbug kbpending KB271661

-

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

© Microsoft Corporation. All rights reserved.