Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

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.

↑ Back to the top


Cause

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

↑ Back to the top


Resolution

The following updates are required:
  1. 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
  2. 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:

↑ Back to the top


Status

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

↑ Back to the top


More information

Steps to Reproduce the Behavior

  1. Create a new Access 2000 database.
  2. Create a table named Table1 that has a single Text field named Field1.
  3. Add an index to the Field1 field.
  4. Switch the Table1 table to Datasheet view.
  5. Add the following data to the Field1 field:
       g2-1-40
       g2-1-41
       g2-1-42
       g2-1-43
       g2-1-44
    					
  6. Close and save the table.
  7. 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.
  8. In the Query Designer, click SQL View on the View menu.
  9. Type the following into the SQL view:
       SELECT Table1.field1
       FROM Table1
       WHERE (((Table1.field1) Like "g2-1*"));
    					
  10. Run the query. Note that no rows are returned.
  11. Close and save the query as Query1.
  12. Open the Table1 table in Design view, and then remove the index from the Field1 field.
  13. Close and save the table.
  14. Run the Query1 query again. Note that now the correct rows are returned.

↑ Back to the top


Article Info
Article ID : 271661
Revision : 5
Created on : 1/1/0001
Published on : 1/1/0001
Exists online : False
Views : 326