Question

I have two tables in access database. First table is named Program, its fields are Program ID and Program Name, the Program ID is the primary key for this table. The second table is named Partner, its fields are Partner ID and Partner Name, the Partner ID is the primary key for the Partner table. I have another table, which is an intersection table, which shows all the connections between the program and the partner tables. The intersection table has the fields Program ID, Program Name, Partner ID and Partner Name. I have a one-many relationship between the program table and the intersection table and a one - many relationship between the partner table and the intersection table. I also have the referential integrity selected on both these relationships (both update and delete selected). My problem is : If I make any changes to the Program Name in the program table then I want the change to be updated into the intersection tables Program Name field also. Similarly for the Partner Name field. I am unable to do this. I tried adding the Program Name field to the existing relation ship on the Program ID between the program and the intersection table, but access does not allow me to enforce referential integrity, it gives error: "No unique index for the referenced field in the primary table". I have also tried creating a Unique index on the Program Name field (not primary key). Can anyone please advice me some options. Thank You.

Was it helpful?

Solution

Your intersection table should not include the Program/Partner Names at all, it should only include the Program/Partner ID values.

By keeping a copy of the names in the intersection table you have denormalized your data. This is generally considered to be a "Bad Thing".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top