Question Locked

Autonumbering Problem

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have two forms that populate one table. This table's primary key generates an autonumber. Everything works fine (ie: a new number is generated for each new entry) except when I go to close the form after the entry. Doing so generates a prohibiting error message:

"The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again."

I set this up this way because I am filling sender and receipient addresses references that draw from the same table. What am I doing wrong? Is there a better way to do this?

3 replies

by absolutely

Anyway, the "preferred" approach is to store sender and recipient addresses in separate tables, and link rows, as necessary, via an intermediate table. That contains at least 2 fields, which are copies of the primary keys used by the other two tables. That allows one-to-many, many-to-one & many-to-many data relationships, which allows many minor repairs like the one you're trying to do now to be possible with minimal impact & effort.

HTH

by alan williams

1 - it is saving the last entry again when you close the form, including the autonummber field.
2 - The foreeign key in the linked table does not allow duplicates in that field.

This discussion is closed to new replies.