To start, let me say that I'm trying to model this database after an existing documentation system. I wish I could change the system structure, but I'm stuck with trying to model what someone else has made.
There are two types of documents that I want to set up relationships between:
Finished Goods (FG)
Multi-Document Work Instructions (MDWI)
Some of the FG are unique and contain their own work instructions. Other FG are similar to each other, and use a MDWI for their work instructions (i.e. if two FG have identical work instructions, but are slightly different sizes, then the MDWI houses the instructions to make those FG). There are cases where a FG uses multiple MDWI, but never where it uses a FG and a MDWI for it's instructions. I have structured the tables as such:
tblFG: contains an entry for each FG
tblMDWI: contains an entry for each MDWI
Now I want to create a table that describes where the work instructions for each FG are. The table might look something like this:
FG | WI
FG1 | FG1
FG2 | FG2
FG3 | MDWI1
FG4 | MDWI1
FG5 | FG5
FG6 | MDWI2
FG6 | MDWI3
FG7 | MDWI2
FG7 | MDWI3
etc.
Now I'd like to be able to set up the relationships such that the only values that can be in the 'FG' field of this table are values in 'tblFG', but that the values in the 'WI' field can be in 'tblFG' or in 'tblMDWI'. I can set up a 'One to Many' between the 'FG' field in this table and 'tblFG', but then I cannot setup a 'One to Many' on the 'WI' field.
Should I be structuring my tables differently? Am I overlooking some way to set up this relationship? Is this just not possible because of the way the system is designed?
See attached picture. This is as far as I got before running stuck.
There are two types of documents that I want to set up relationships between:
Finished Goods (FG)
Multi-Document Work Instructions (MDWI)
Some of the FG are unique and contain their own work instructions. Other FG are similar to each other, and use a MDWI for their work instructions (i.e. if two FG have identical work instructions, but are slightly different sizes, then the MDWI houses the instructions to make those FG). There are cases where a FG uses multiple MDWI, but never where it uses a FG and a MDWI for it's instructions. I have structured the tables as such:
tblFG: contains an entry for each FG
tblMDWI: contains an entry for each MDWI
Now I want to create a table that describes where the work instructions for each FG are. The table might look something like this:
FG | WI
FG1 | FG1
FG2 | FG2
FG3 | MDWI1
FG4 | MDWI1
FG5 | FG5
FG6 | MDWI2
FG6 | MDWI3
FG7 | MDWI2
FG7 | MDWI3
etc.
Now I'd like to be able to set up the relationships such that the only values that can be in the 'FG' field of this table are values in 'tblFG', but that the values in the 'WI' field can be in 'tblFG' or in 'tblMDWI'. I can set up a 'One to Many' between the 'FG' field in this table and 'tblFG', but then I cannot setup a 'One to Many' on the 'WI' field.
Should I be structuring my tables differently? Am I overlooking some way to set up this relationship? Is this just not possible because of the way the system is designed?
See attached picture. This is as far as I got before running stuck.