## MSQuery: Illegal Duplicate Key When Adding Character Data

The information in this article applies to:

- Microsoft Excel for Windows, version 5.0
- Microsoft Query version 1.0

## SUMMARY

When you add records to a table, if an index field (whose type is defined as character) is left blank, and if Microsoft Query is instructed to add another new record, the following error message will appear:

> Illegal Duplicate Key.

After a record is entered, Microsoft Query adds an empty record below it, ready for data input. The character field in the previously entered record is also empty; therefore, when Microsoft Query adds a new, blank record, the two character fields are duplicates of one another and Microsoft Query reports the error described above.
When you receive this error message, acknowledge the message and return to the just completed record to enter the correct value in the appropriate field.

## WORKAROUND

To avoid the error message, entered data in the blank field.

## MORE INFORMATION

### Steps to Reproduce Problem

1. From the File menu, choose New Query.
2. From the Available Data Sources, select dBASE Files.
3. Choose Use, and then select a .DBF file.
   NOTE: The .DBF file must be indexed (that is, sorted by dBASE).
4. Choose Add, and then choose Close.
5. In the table pane, double-click the asterisk (*) to show all records.
6. From the Records menu, choose Allow Editing.
7. Note that a new blank record is added to the bottom of the query table.
8. Move to the bottom of the table and add information, leaving a character field empty.
9. Press the DOWN ARROW key to add the current record and create a new, empty record.

An alert box will appear with the message "Illegal duplicate key."

Additional query words: datafield MS

Keywords : xlquery
Version : 5.00
Platform : WINDOWS
Issue type :
Technology :

Last Reviewed: September 9, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use.