MSQuery: "Illegal Duplicate Key" After Creating Index

Last reviewed: September 12, 1996
Article ID: Q121599
The information in this article applies to:
  • Microsoft Query for Windows, version 1.0

SYMPTOMS

In Microsoft Query, if you use a dBASE, Microsoft FoxPro, or Microsoft Access data source to create a unique index using an index field that does not contain unique data, the index is created successfully; however, when you close the Create Index dialog box, you receive the following error message:

   Illegal duplicate key

When you receive this error message, any of the following may have occurred:
  • The table you saved was not created. This behavior occurs when you use the version of Microsoft Query that ships with Microsoft Excel version 5.0.

    -or-

  • The table you saved was created, but the table only contains the first records that do not have duplicate entries in the field that you used to create the index. This behavior occurs when you use the version of Microsoft Query that ships with Microsoft Excel version 5.0c.

CAUSE

This behavior occurs because, when you create an index in the process of saving a new table, the index is created before the data is inserted into the table. Because of the order of this process, the data source does not know whether a field is unique or not. It is possible then to create a unique index on a field that is not unique.

WORKAROUND

To avoid these problems, only create a unique index for a table when you are certain that the index field that you select uniquely identifies the records in the database.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

REFERENCES

For more information about the Create Index Dialog Box, choose the Search button in Help and type:

    creating indexes


KBCategory: kbtool kberrmsg
KBSubcategory: xlquery

Additional reference words: 1.00 5.00 5.00c err msg



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 12, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.