restricted append

G

Guest

Hello,

I am using an append table. I append seven columns of data and then the last
two columns are the month and year. Is it possible to restrict the user from
appending the information if the month and year are already in the
destination table. So, when the user runs the query to append the data, a
message box stops and says that the data is currently in the table and cannot
be processed.

Thank You,
 
G

Guest

Here is the SQL for an append I do where we want to add new employees to a
table. The source table may have employees that are already in the
destination table. Notice the last part of the Where Clause. It basically
says append the employee is he is not already in the table. The group by may
not apply to you. I do it here because the same employee may show up
multiple times in the source table.

INSERT INTO tbllkEmployee ( EmployeeNum, EmployeeName, EmployeeAcctUnit )
SELECT BillCurrMonth3345.EmployeeId, BillCurrMonth3345.EmployeeName,
BillCurrMonth3345.PerformAcctUnit
FROM BillCurrMonth3345 LEFT JOIN tbllkEmployee ON
BillCurrMonth3345.EmployeeId = tbllkEmployee.EmployeeNum
GROUP BY BillCurrMonth3345.EmployeeId, BillCurrMonth3345.EmployeeName,
BillCurrMonth3345.PerformAcctUnit, BillCurrMonth3345.Type,
tbllkEmployee.EmployeeNum
HAVING (((BillCurrMonth3345.Type)="L") AND ((tbllkEmployee.EmployeeNum) Is
Null));
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top