ACC: Append Query Results in Duplicate Counter NumbersLast reviewed: May 28, 1997Article ID: Q94105 |
The information in this article applies to:
SYMPTOMSModerate: Requires basic macro, coding, and interoperability skills. A table to which you append data using an append query now has duplicated numbers in a field defined as an AutoNumber data type in Microsoft Access 7.0 and 97 or Counter data type in Microsoft Access 2.0 or earlier. The expected result is appended data with incremented numbers in the AutoNumber or Counter field.
CAUSEYour append query is explicitly referencing the field with the AutoNumber or Counter data type. You are, in essence, overriding the automatic AutoNumber or Counter function that you specified in your table design. This may result in duplicate numbers.
RESOLUTIONDo not include a field with an AutoNumber or Counter data type in the Append To row of the QBE grid in your append query. By omitting this field in your append query, Microsoft Access will automatically generate incremental numbers in the appended table's AutoNumber or Counter field.
STATUSThis behavior is by design.
MORE INFORMATIONYou will receive duplicates only if there is no Primary Key or Index (No) defined on the AutoNumber or Counter field in the table to which you are appending. By definition, primary keys are unique. Including fields with AutoNumber or Counter data types in your append query may also result in noncontiguous numbers in the table to which you are appending. For example, if the table to which you are appending has values of 1 to 20 in the AutoNumber or Counter field, and the table from which you are appending has values of 20, 34, and 55, you will end up with one duplicate value. The next time you add a new row to the table to which you are appending, the AutoNumber or Counter field will be assigned a value of 56. |
Keywords : kbusage QryMktbl
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |