G
Guest
I need to stop the following query from running if entries already exist.
This is an append query that takes names from the table "Employee" and
inserts them into another table, "Activities". The query also calculates the
last day of the previous month and inserts that with each name. If an entry
already exists in the Activities table for a particular person's name and the
last day of the previous month, then I don't want the query to run. For
example, if the Activities table already contains an entry for "John Doe"
dated 12/31/2006, the query should abort. If John Doe has no entry for
12/31/2006, then it would run. Am I making sense?
INSERT INTO activities ( employee, officerNumber, [month] )
SELECT Employees.Full_Name, Employees.officerNumber,
DateSerial(Year(Date()),Month(Date()),0) AS [Month]
FROM Employees
WHERE (((Employees.Status)="active" And (Employees.Status)="active" And
(Employees.Status)="active"));
I need to know how to modify this query so it won't run if the conditions I
described above exist. Your help is greatly appreciated!
GwenH
Some of my best leading men have been dogs and horses. ~ Elizabeth Taylor
This is an append query that takes names from the table "Employee" and
inserts them into another table, "Activities". The query also calculates the
last day of the previous month and inserts that with each name. If an entry
already exists in the Activities table for a particular person's name and the
last day of the previous month, then I don't want the query to run. For
example, if the Activities table already contains an entry for "John Doe"
dated 12/31/2006, the query should abort. If John Doe has no entry for
12/31/2006, then it would run. Am I making sense?
INSERT INTO activities ( employee, officerNumber, [month] )
SELECT Employees.Full_Name, Employees.officerNumber,
DateSerial(Year(Date()),Month(Date()),0) AS [Month]
FROM Employees
WHERE (((Employees.Status)="active" And (Employees.Status)="active" And
(Employees.Status)="active"));
I need to know how to modify this query so it won't run if the conditions I
described above exist. Your help is greatly appreciated!
GwenH
Some of my best leading men have been dogs and horses. ~ Elizabeth Taylor