Link to home
Start Free TrialLog in
Avatar of meade470
meade470

asked on

Shared Primary Key not updated between mulitple tables.

I have what I hope is a simple question.

I have a simple database with three tables.  Each table has a primary key of "name".  Other information is not shared across the databases.  I have referential integrity and cascading enforced.  When I update the "name" field in one table, the "name" fields in the other tables are not updated.  Suggestions?

Thanks!!
Avatar of GRayL
GRayL
Flag of Canada image

Name is an Access reserved word and should not be used as a table, field, or variable name.  Only one of the tables with name can be designated as a primary key.  The other two tables have to have nameid as a foreign keys.
Avatar of thenelson
thenelson

Cascading can be set only for additions and deletions of record, not for changing the records.  You would have to do this yourself with after update and an update query.  But more important do not use real useful information for your referential key fields for exactly this reason and others!  If your users are going to see and use "name", create another field that can be an autonumber field in one table and number field of long type in the other tables for the referencing.  Don't let your users be able to change these numbers (ususally don't let them see it either - but the only problem with that is that someone will ask you if they can change that number, to which you would answer no.)
That is to say you have used therelationships tab to build the relation between the tables.
indexed the two foreign keys, and set cascading on here. I think it has something to do with not being able to update a primary key via a query, which is essentially how Access would handle the cascading.
Avatar of meade470

ASKER

Can't I have a database in which a "shared" field can be updated by making changes to a single table?  Does this require an update query?
that's right grayl cascade updates would only be propogated on foreign keys.
I guess the question is why has meade470 chosen to struture the database in this way
ASKER CERTIFIED SOLUTION
Avatar of Natchiket
Natchiket
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial