Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem w/Auto-Numbered Primary Key 1

Status
Not open for further replies.

Xeseus

Technical User
Jan 16, 2007
35
US
I am filling the sender & recipient fields for a logistics company's Invoice table by drawing from a single address table. I enter "new" addresses using two forms (one for the sender field, one for the recipient field) that populate the common address table and the Invoice table's record. As I attempt to create a new address the address table's primary key generates an auto-number, but when I go to close the form after the entry I get this prohibitory 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."

What am I doing wrong? Is there a better way to do this?
 
Well that could be a couple of dozen things. Are you using the NotInList event of a ComboBox to open the "New" Address form? If not then how do you do it?

HTH RuralGuy (RG for short) acXP winXP Pro
Please respond to this forum so all may benefit
 
Hi x,

Are you sure that only the autonumber key is the ONLY key for the table? Either that, or another field has index set to not allow duplicates.

ATB

Darrylle

Never argue with an idiot, he'll bring you down to his level - then beat you with experience.
 
I am a little embarrassed to say that I missed something that should have been obvious to me. I found that in addition to the primary and foreign keys, I had another field that required a unique value and over looked it. I was focused on something else and had left this field blank. I am not familiar with the NotInList event, though, and I will have to look into that - it sounds very interesting and useful. Thank you very much for your help!
 
Glad to hear you got it sorted.

HTH RuralGuy (RG for short) acXP winXP Pro
Please respond to this forum so all may benefit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top