Allen said:
I'm not clear what you need here.
I assume the OP needs a way of ensuring that only an EmployeeID that
exists in their Personnel tables is used in their 'junction' table and
that when EmployeeID is UPDATEd in the Employees table the change is
automatically made in their 'junction' table too (ON UPDATE CASCADE)
and a DELETE is similarly propagated (ON DELETE CASCADE). Same goes for
SkillID.
How to I establish the foreign key constraint? That's a lifestyle
choice: GUI tools, SQL code, DAO, ADO, etc. I'd recommend doing it in
SQL DDL (data definition language) when creating the table (via the OLE
DB provider for Jet 4.0 is best) e.g.
CREATE TABLE Skillsbase (
EmployeeID CHAR(10) NOT NULL
REFERENCES Personnel (EmployeeID)
ON DELETE CASCADE
ON UPDATE CASCADE,
SkillID CHAR(10) NOT NULL
REFERENCES Skills(SkillID)
ON DELETE CASCADE
ON UPDATE CASCADE,
PRIMARY KEY (EmployeeID, SkillID));