S
Sierras
Hi
I have an append query which takes all the active employees from the
employee table and appends them to a sector table for other purposes. I
tried not to do it this way by adding a field to the employee table for
sectors, but the employee may go to more than one sector.
So I had to do it this way. Anyway,...
This works well:
INSERT INTO tblEmployeesSectors ( IDEmployees )
SELECT tblEmployees.IDEmployee
FROM tblEmployees
WHERE (((tblEmployees.ActiveEmployee)=Yes));
I also have a delete query for the sector table which removes all inactive
employees. This also works well:
DELETE tblEmployeesSectors.*, tblEmployees.ActiveEmployee, *
FROM tblEmployees INNER JOIN tblEmployeesSectors ON
tblEmployees.IDEmployee = tblEmployeesSectors.IDEmployees
WHERE (((tblEmployees.ActiveEmployee)=No));
The problem is when the user wants to update the Sector table with any new
active employees.
I can not find a way to update just the new records without touching the
ones currently in the sector table. When the append query is run again,
there are duplicate entries for any record that the user updated in the
sector table.
Any way to update or append just the new records based on the EmployeeID?
Bascially, don't update or append that same employee id if it already
exists in the sector table.
I have an append query which takes all the active employees from the
employee table and appends them to a sector table for other purposes. I
tried not to do it this way by adding a field to the employee table for
sectors, but the employee may go to more than one sector.
So I had to do it this way. Anyway,...
This works well:
INSERT INTO tblEmployeesSectors ( IDEmployees )
SELECT tblEmployees.IDEmployee
FROM tblEmployees
WHERE (((tblEmployees.ActiveEmployee)=Yes));
I also have a delete query for the sector table which removes all inactive
employees. This also works well:
DELETE tblEmployeesSectors.*, tblEmployees.ActiveEmployee, *
FROM tblEmployees INNER JOIN tblEmployeesSectors ON
tblEmployees.IDEmployee = tblEmployeesSectors.IDEmployees
WHERE (((tblEmployees.ActiveEmployee)=No));
The problem is when the user wants to update the Sector table with any new
active employees.
I can not find a way to update just the new records without touching the
ones currently in the sector table. When the append query is run again,
there are duplicate entries for any record that the user updated in the
sector table.
Any way to update or append just the new records based on the EmployeeID?
Bascially, don't update or append that same employee id if it already
exists in the sector table.