Automatically updating one table from another

Deb6508

Board Regular
Joined
Oct 25, 2004
Messages
131
Hi All,
I have two tables in a database. One table contains personnel info and the other table contains training information. What I would like to have happen is when an employee is deleted from the personnel table that persons training information is then deleted automatically.
Any ideas or help I would greatly appreciate.
Deb
 

Some videos you may like

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

MyBoo

Board Regular
Joined
Aug 9, 2006
Messages
217
This would happen automatically if you had a relationship defined between the two tables.

How do you identify the training records associated with the personnel records now? If your personnel table contains a primary key... a unique identifier... EmployeeID (for example), you could add that field to the training table... but NOT as a primary key... as a foreign key. Then click on Tools/Relationships, display both tables and drag/drop the EmployeeID from the personnel table to the same field in the training table. This will display a window for you to create the relationship. Set it to cascade delete, then save.

When you delete a record from the personnel table, all associated training records will be removed from the training table.
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,835
Office Version
  1. 365
Platform
  1. Windows
Why delete the record?

Couldn't you just add a field that indicates the current status of the employee?
 

Watch MrExcel Video

Forum statistics

Threads
1,109,518
Messages
5,529,314
Members
409,862
Latest member
lbisacca
Top