I have created four tables in MS Access to describe allowable configurations of personal fire fighting equipment for use as part of an asset register. The details follow:
TBL_1 : FIRE_CLASSIFICATION
FIELDS : | PK | CLASS |
---------------------------------------
ENTRIES : | 1 | Fire Blanket |
| 2 | Fire Extinguisher |
| 3 | Fire Hose Reel |
TBL_2 : FIRE_TYPE
FIELDS : | PK | TYPE | FK_CLASS |
------------------------------------------------------------
ENTRIES : | 1 | General | Fire Blanket |
| 2 | Carbon Dioxide | Fire Extinguisher |
| 3 | Foam | Fire Extinguisher |
| 4 | Powder ABE | Fire Extinguisher |
| 5 | Powder BE | Fire Extinguisher |
| 6 | Vap. Liquid | Fire Extinguisher |
| 7 | Water | Fire Extinguisher |
| 8 | Wet Chemical | Fire Extinguisher |
| 9 | General | Fire Hose Reel |
TBL_3 : FIRE_SPECIFIC
FIELDS : | PK | SPECIFIC | FK_CLASS |
------------------------------------------------------------
ENTRIES : | 1 | Dimensions | Fire Blanket |
| 2 | Capacity (kg) | Fire Extinguisher |
| 3 | Length (m) | Fire Hose Reel |
TBL_4 : FIRE_OPTIONS
FIELDS : | PK | FK_CLASS | FK_TYPE | FK_SPECIFIC | OPTION |
----------------------------------------------------------------------------------
ENTRIES : | 1 | Fire Extinguisher | Carbon Dioxide | Capacity (kg) | 2.0 |
| 2 | Fire Extinguisher | Carbon Dioxide | Capacity (kg) | 3.5 |
| 3 | Fire Extinguisher | Carbon Dioxide | Capacity (kg) | 5.0 |
| 4 | Fire Extinguisher | Powder ABE | Capacity (kg) | 1.1 |
| 5 | Fire Extinguisher | Powder ABE | Capacity (kg) | 2.1 |
| 6 | Fire Extinguisher | Powder ABE | Capacity (kg) | 2.3 |
| 7 | Fire Extinguisher | Powder ABE | Capacity (kg) | 2.7 |
| 8 | Fire Extinguisher | Powder ABE | Capacity (kg) | 4.5 |
| 9 | Fire Extinguisher | Powder ABE | Capacity (kg) | 9.0 |
| 10 | Fire Hose Reel | General | Length (m) | 12.0 |
... CONTINUED
Currently it is possible to insert entries such as
| 11 | Fire Hose Reel | Powder ABE | Dimensions | 1200 x 1200 |
into the FIRE_OPTIONS table. This behaviour is very undesirable as this entry does not conform to the declared (allowable) combinations specified in the other tables.
I would like to understand how I can implement suitable constraints on the FIRE_OPTIONS table so that an error is generated whenever a specified entry is not consistent with the other three tables.
I have tried using the "Database Tools"-"Relationships" feature however I have not been able to "Enforce Referential Integrity" between TBL_4 with TBL_1, TBL_2 and TBL_3 concurrently.
I would greatly appreciate any assistance with this issue.
** Edit
I was able to solve this problem through amending the Primary Key definitions. This is detailed below:
TBL_1 : FIRE_CLASSIFICATION
PK: PK (Auto Increment)
TBL_2 : FIRE_TYPE
PK: PK (Auto Increment) & FK_CLASS
TBL_3 : FIRE_SPECIFIC
PK: PK (Auto Increment) & FK_CLASS
TBL_4 : FIRE_OPTIONS
PK: PK (Auto Increment)
I then defined the following relationships within the "Database Tools"-"Relationships" feature:
[ERI] FIRE_CLASSIFICATION.PK (1) -> FIRE_TYPE.FK_CLASS (MANY)
[ERI] FIRE_CLASSIFICATION.PK (1) -> FIRE_SPECIFIC.FK_CLASS (MANY)
[ERI] { FIRE_CLASSIFICATION.PK (1) -> FIRE_OPTIONS.FK_CLASS (MANY)
FIRE_TYPE.PK (1) -> FIRE_OPTIONS.FK_TYPE (MANY)
FIRE_TYPE.FK_CLASS (1) -> FIRE_OPTIONS.FK_CLASS (MANY)
FIRE_SPECIFIC.PK (1) -> FIRE_OPTIONS.FK_SPECIFIC (MANY)
FIRE_SPECIFIC.FK_CLASS (1) -> FIRE_OPTIONS.FK_CLASS (MANY) }
ERI : "Enforce Referential Integrity" Option Selected