From: boooney on 13 Apr 2010 20:46 I have read that "in a junction table, you need to set the primary key to include the primary key fields from the other two tables. " If I do this, I keep getting the error message "the change you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. The only way I'm entering data is through a form based on a query which automatically writes to all 3 tables (the junction and 2 parents) at once. If I remove the primary keys in the junction tables, I no longer get the error message. Am I going to regret this later? Thanks.
From: John W. Vinson on 13 Apr 2010 22:11 On Tue, 13 Apr 2010 17:46:01 -0700, boooney <boooney(a)discussions.microsoft.com> wrote: >I have read that "in a junction table, you need to set the primary key to >include the primary key fields from the other two tables. " Well, it's a good idea, but it's not in fact obligatory. >If I do this, I keep getting the error message "the change you requested to >the table were not successful because they would create duplicate values in >the index, primary key, or relationship. Sounds like you defined just one of the fields as the primary key, rather than ctrl-clicking both fields and clicking the Key icon. Both foreign keys should have the key icon next to them in table design view - not just one of them. >The only way I'm entering data is through a form based on a query which >automatically writes to all 3 tables (the junction and 2 parents) at once. Generally a Very Bad Idea. Why not use the tools that Access provides - a form based on one of the "one" side tables, and a subform based on the junction table? >If I remove the primary keys in the junction tables, I no longer get the >error message. Am I going to regret this later? Junction tables, plural? Are there more than one? -- John W. Vinson [MVP]
|
Pages: 1 Prev: design and replication Next: Fields not showing up in columns |