MJH
MJH

Reputation: 859

auto number field has duplicates

How is this possible? I have a table Contacts, with a field contactId, which is Autonumber type. I ran the following query on it:

SELECT ContactId
FROM Contacts
GROUP BY contactId
HAVING Count(ContactId) > 1

And I got 9 records.

Upvotes: 0

Views: 767

Answers (1)

Sergey S.
Sergey S.

Reputation: 6336

It is possible because you can insert any value in Autonumber field using INSERT SQL. After this Access will generate next number = last inserted + 1, but not = max number + 1. In order to avoid this add primary or unique key to autonumber field.

Upvotes: 2

Related Questions