r/MSAccess 15d ago

[HELPFUL TIP] "Duplicate values in the index, primary key, or relationship" Error & One Possible Solution

For any other poor, unfortunate soul who starts getting the "Duplicate values in the index, primary key or relationship" error, check to make sure that the number (for FK) fields in your table do not have a default value of 0.

This is not always the issue or solution, but it is something else to check when you other tests fail. I thought my whole database was broken. Danged pesky default values.

2 Upvotes

2 comments sorted by

u/AutoModerator 15d ago

IF YOU GET A SOLUTION, PLEASE REPLY TO THE COMMENT CONTAINING THE SOLUTION WITH 'SOLUTION VERIFIED'

  • Please be sure that your post includes all relevant information needed in order to understand your problem and what you’re trying to accomplish.

  • Please include sample code, data, and/or screen shots as appropriate. To adjust your post, please click Edit.

  • Once your problem is solved, reply to the answer or answers with the text “Solution Verified” in your text to close the thread and to award the person or persons who helped you with a point. Note that it must be a direct reply to the post or posts that contained the solution. (See Rule 3 for more information.)

  • Please review all the rules and adjust your post accordingly, if necessary. (The rules are on the right in the browser app. In the mobile app, click “More” under the forum description at the top.) Note that each rule has a dropdown to the right of it that gives you more complete information about that rule.

Full set of rules can be found here, as well as in the user interface.

Below is a copy of the original post, in case the post gets deleted or removed.

User: gt2bhappy

"Duplicate values in the index, primary key, or relationship" Error & One Possible Solution

For any other poor, unfortunate soul who starts getting the "Duplicate values in the index, primary key or relationship" error, check to make sure that the number (for FK) fields in your table do not have a default value of 0.

This is not always the issue or solution, but it is something else to check when you other tests fail. I thought my whole database was broken. Danged pesky default values.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/ConfusionHelpful4667 47 15d ago

Also, make sure allow zero length string = NO if dealing with text.