T
tbrogdon
I have tblEmployeeProduction which is populated via a form using an
Update query with the following sql:
PARAMETERS forms![frmSetEmpHours]![txtDate] DateTime;
INSERT INTO EmployeeProduction ( EmployeeID, ProductionDate,
Department, Shift, JobFunctionID, ShiftHours )
SELECT Employees.EmployeeID, forms!frmSetEmpHours!txtDate AS
ProductionDate, Employees.Department, Employees.Shift, JobFunctionID,
Shift.ShiftHours
FROM Shift INNER JOIN Employees ON Shift.Shift=Employees.Shift
WHERE (((Employees.Department)=forms!frmSetEmpHours!cboDept) And
((Employees.Shift)=forms!frmSetEmpHours!cboShift));
This all works great. The reason for returning Shift.ShiftHours is
that 3rd shift works 7.5 hours instead of 8 hours like 1st and 2nd
shift. JobFunctionID denotes one of the following 3 values:
1 (Operator), 2 (Assembler), or 3 (Other).
So currently, my query returns the appropriate default number of total
hours for each employee by shift and it returns the appropriate
JobFunctionID.
However, any given employee can work more or less hours AND they can
work as both an operator or an assembler and I need to know how many
hours they worked in either capacity.
What I have considered doing is deleting the field
tblEmployeeProduction.ShiftHours and replace it with 2 fields:
HoursOperator and HoursAssembler.
In tblEmployee.JobFunctionID, each employee is categorized as either
and Operator or an Assembler so what I could do is have my query do
something like this both new fields:
If (Shift = 3 and JobFunctionID = 1 then HoursOperator = 7.5 or if
Shift = 3 and JobFunction <> 1 then HoursOperator = 0 )
Else If (Shift <> 3 AND JobFunctionID = 1 then HoursOperator = 8 or if
Shift <> 3 and JobFunctionID <> 1 then HoursOperator = 0)
HoursAssembler would be exactly the sme thing with the substitution of
the field name.
But I am a novice at SQL and can't figure out the correct way to write
this.
Thanks in advance,
Tim
Update query with the following sql:
PARAMETERS forms![frmSetEmpHours]![txtDate] DateTime;
INSERT INTO EmployeeProduction ( EmployeeID, ProductionDate,
Department, Shift, JobFunctionID, ShiftHours )
SELECT Employees.EmployeeID, forms!frmSetEmpHours!txtDate AS
ProductionDate, Employees.Department, Employees.Shift, JobFunctionID,
Shift.ShiftHours
FROM Shift INNER JOIN Employees ON Shift.Shift=Employees.Shift
WHERE (((Employees.Department)=forms!frmSetEmpHours!cboDept) And
((Employees.Shift)=forms!frmSetEmpHours!cboShift));
This all works great. The reason for returning Shift.ShiftHours is
that 3rd shift works 7.5 hours instead of 8 hours like 1st and 2nd
shift. JobFunctionID denotes one of the following 3 values:
1 (Operator), 2 (Assembler), or 3 (Other).
So currently, my query returns the appropriate default number of total
hours for each employee by shift and it returns the appropriate
JobFunctionID.
However, any given employee can work more or less hours AND they can
work as both an operator or an assembler and I need to know how many
hours they worked in either capacity.
What I have considered doing is deleting the field
tblEmployeeProduction.ShiftHours and replace it with 2 fields:
HoursOperator and HoursAssembler.
In tblEmployee.JobFunctionID, each employee is categorized as either
and Operator or an Assembler so what I could do is have my query do
something like this both new fields:
If (Shift = 3 and JobFunctionID = 1 then HoursOperator = 7.5 or if
Shift = 3 and JobFunction <> 1 then HoursOperator = 0 )
Else If (Shift <> 3 AND JobFunctionID = 1 then HoursOperator = 8 or if
Shift <> 3 and JobFunctionID <> 1 then HoursOperator = 0)
HoursAssembler would be exactly the sme thing with the substitution of
the field name.
But I am a novice at SQL and can't figure out the correct way to write
this.
Thanks in advance,
Tim