C
Charles E Finkenbiner
Hi All,
I am new to Access and 'Referential Integrity' is a new concept for me.
In order to understand it better I started working on some sample
tables with old data I had. I thought I had understood it fairly well
until I ran into a problem. Let me explain my table setup, hope this is
not too long.
Table/Fields:
Countries:
2Code - Text - Primary and Unique key
3Code - Text - Not required
Number - Text - Not required, Input mask 000
Name - Text - Not required
States:
Code - Text - Primary and Unique key
CountryCode - Text - Not required
Name - Text - Not required
Code and CountryCode can not be combined into 1 primary key because APO
and FPO codes to not have a country code assigned to them, only a state
code.
Counties:
ID - AutoNumber - Primary and Unique key
StateCode - Text - Required, no zero length
Name - Text - Not required
Cities:
ID - AutoNumber - *
CountyID - Number - *
Name - Text - Not required
* Both fields are joined together as a Primary and Unique key
ZipCodes:
ID - AutoNumber - *
CountyID - Number - *
CityID - Number - *
ZipCode - Text - Not required, Input mask 00000#9999
* All 3 fields are joined together as a Primary and Unique key
Now I want to setup one to many 'Referential Integrity', including
'Cascade Update and Delete', between all 5 tables.
Countries to States
2Code -----> CountryCode - OK
States to Counties
Code -----> StateCode - Failed
Counties to Cities
CountyID -----> CountyID - OK
Cities to ZipCodes
CityID -----> CityID - OK
So, on the 'Relationships' page I have 5 tables in a row, each linking
to the next.
Can someone please explain to me why 'Referential Integrity' will not
work between the States and Counties tables? Yes, I can setup a normal
relationship but them the 'Cascade Update and Delete' will be broken and
not travel down to the remaining tables.
Thanks for any and all help,
Charles
I am new to Access and 'Referential Integrity' is a new concept for me.
In order to understand it better I started working on some sample
tables with old data I had. I thought I had understood it fairly well
until I ran into a problem. Let me explain my table setup, hope this is
not too long.
Table/Fields:
Countries:
2Code - Text - Primary and Unique key
3Code - Text - Not required
Number - Text - Not required, Input mask 000
Name - Text - Not required
States:
Code - Text - Primary and Unique key
CountryCode - Text - Not required
Name - Text - Not required
Code and CountryCode can not be combined into 1 primary key because APO
and FPO codes to not have a country code assigned to them, only a state
code.
Counties:
ID - AutoNumber - Primary and Unique key
StateCode - Text - Required, no zero length
Name - Text - Not required
Cities:
ID - AutoNumber - *
CountyID - Number - *
Name - Text - Not required
* Both fields are joined together as a Primary and Unique key
ZipCodes:
ID - AutoNumber - *
CountyID - Number - *
CityID - Number - *
ZipCode - Text - Not required, Input mask 00000#9999
* All 3 fields are joined together as a Primary and Unique key
Now I want to setup one to many 'Referential Integrity', including
'Cascade Update and Delete', between all 5 tables.
Countries to States
2Code -----> CountryCode - OK
States to Counties
Code -----> StateCode - Failed
Counties to Cities
CountyID -----> CountyID - OK
Cities to ZipCodes
CityID -----> CityID - OK
So, on the 'Relationships' page I have 5 tables in a row, each linking
to the next.
Can someone please explain to me why 'Referential Integrity' will not
work between the States and Counties tables? Yes, I can setup a normal
relationship but them the 'Cascade Update and Delete' will be broken and
not travel down to the remaining tables.
Thanks for any and all help,
Charles