Append Queries

M

Melinda

I have a database in which I am tracking overtime hours for the company.
The hours are sorted in a table by an overtime code, such as 1=overtime
worked, 2=overtime refused, 3=callback pay, etc., etc. Once a year, per
our union contract I need to roll back the "total" overtime. So I have
hours worked + hours refused = ytd hours. Karl Dewey was helping me and
then my computer crashed and I have left it go for a couple of weeks. He
was heading me in the direction to append a negative total to rollback in the
main table. This works except if I have an employee who has 22.2 hours
worked + 2.2 hours refused for a total of 24.4 when I rollback the -24.4 it
shows it as -2.2 in the hours worked + 2.2 hours refused for a 0 total. I
need it to zero out the refused hours and the hours worked. I know this is
quite confusing. Here is the SQL I have so far.
INSERT INTO tblhours ( EmployeeName, TMSEmployeeNo, DateWorked,
OvertimeCodes, HoursWorked )
SELECT tblHours.EmployeeName, tblHours.TMSEmployeeNo, Date() AS X,
"Rollback" AS Y, -[Enter the number of hours to rollback] AS Z
FROM tblEmployees INNER JOIN tblHours ON tblEmployees.Tmsemployeeno =
tblHours.TMSEmployeeNo
GROUP BY tblHours.EmployeeName, tblHours.TMSEmployeeNo, "Rollback", -[Enter
the number of hours to rollback], tblEmployees.ClassNo, tblEmployees.OutPost
HAVING (((tblEmployees.ClassNo)="52133") AND ((tblEmployees.OutPost)>-1));

Hopefully this help.
Thanks in advance, Melinda
 

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

Similar Threads

SQL 0
Negative Numbers 2
Append Query 0
Queries? 9
Update Queries 4
Duplicate Field Names 6
Cross tab query I think but do not know how to do it. 0
Update Query 2

Top