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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error: Access: duplicate values in index, primary key or relationships

Status
Not open for further replies.

blackduck603

Technical User
Oct 15, 2007
4
US
I inherited an Access 2005 project that has a form with a subform. The subform is used because there is a good number of data and it is set up using tabs.
I am getting the following error after entering the last field of data for the subform.

"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 allow for duplicate entries."

The weird thing is all of the data on the main form and subform are in the same table. I can't understand how this could be a relationship or indexing problem since it is all in a single table.

FYI: The tabs contain other subforms and some of them use data from other tables, but I have deleted all of those subforms.

So far, the only information that I have found seems to point to bad relationships in the db normalization, but as I mentioned, I am still getting the error with a single table's data.

Appts Table Info
-------------------
ApptID - Autonumber
ApptDesc - Text
ApptDate - Date
LastApptDate - Date
-------------------
There's a bunch more data in the table (dates and text)
The only field that is used to link other tables in the ApptID.
The ApptID, and ApptDesc fields are on the main form and the rest are on the subform (on a tab - currently the only tab that has a form).



I appreciate any information or if someone can shed some light on what might be going on.

Thanks,
Bill

 
I forgot to mention.....
If I click on the NEW RECORD button After I entered data for the ApptDesc (on the main form) then scroll back to this record, I can then enter data with NO ERROR. It seems like it needs the data stored in db before trying to reconcile the subform data...but it is all going into the same table so why would that make a difference.

I poposed this solution (Save record before continuing with subform, but the end-user does NOT want it that way.

H E L P M E
;-)
 
More info...

I created a new form and copied all of the controls from my Main Form and SubForm onto the new control. I set the RecordSource Property to the appropriate table and this form works fine with no errors.

This seems to substantiate my suspiscion that the problem is related to the Sub Form. I think I am missing something about how to get a main form and subform to play together.

???

I appreciate any help.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top