By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,560 Members | 1,093 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,560 IT Pros & Developers. It's quick & easy.

Error Message in form

P: 17
Hi,

I am quite new to access so sorry if this isn't explained very well.

I have a form with a subform in it. My form has a primary key on my 'Plant ID' box.

In my subform I can enter the first row of data fine but when I try and enter another row I get the 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 redifine the index to permit duplicate entries and try again'

How can I get around this, please ask if you need more information,

Many thanks,
Grant
Oct 14 '06 #1
Share this Question
Share on Google+
4 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
Is the source of the subform different from the source of the form (It should be). Is PlantID a foreign key in the source of the subform and is there a control for it on the subform?
Oct 14 '06 #2

P: 17
Is the source of the subform different from the source of the form (It should be). Is PlantID a foreign key in the source of the subform and is there a control for it on the subform?
Many thanks for the reply,

The source of the subform is different to the source of the form.

How do I find out if PlantID is a foreign key in the souce of the subform and how do I see if there is a control?

Many thanks,
Grant
Oct 15 '06 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
Open the subform separately in design view. You should be able to see the control even if it is hidden in form view. Check the source of the subform and make sure that PlantID is included. If the control is not already on the form just drag it on and make it invisible.



Many thanks for the reply,

The source of the subform is different to the source of the form.

How do I find out if PlantID is a foreign key in the souce of the subform and how do I see if there is a control?

Many thanks,
Grant
Oct 15 '06 #4

Expert 100+
P: 1,221
liverpoolrdbest,
Also, you'll want to go look at the definition of each element in the table being updated by this subform. You must have one or more of these elements (it need not be the primary key) defined as an indexed field with no duplicates allowed. To prove the point, make sure in a test that each data item has some different value from the previous records you saved to the table. You won't hit the error until you repeat a value in one of the "no duplicates" fields. Note that duplicates are never allowed in the primary key.

Jim
Oct 16 '06 #5

Post your reply

Sign in to post your reply or Sign up for a free account.