G
Guest
I have an append query that will not work. I can't figure out where the
problem is. When I run the query, an error message about type conversion
failure, or key violation, or lock violation, or validation rule violation
appears.
Here is the SQL statment for the append query:
INSERT INTO tblWeeklyWorkedHours ( UnitID, VacationHours, HolidayHours,
CompHoursUsed, InjuryHours, IllnessHours, WorkWeek )
SELECT tblDailyWorkLog.UnitID, Sum(tblDailyWorkLog.VacationHours) AS
SumOfVacationHours, Sum(tblDailyWorkLog.HolidayHours) AS SumOfHolidayHours,
Sum(tblDailyWorkLog.CompHoursUsed) AS SumOfCompHoursUsed,
Sum(tblDailyWorkLog.InjuryHours) AS SumOfInjuryHours,
Sum(tblDailyWorkLog.IllnessHours) AS SumOfIllnessHours, Format([Date],"ww")
AS Week
FROM tblDailyWorkLog
WHERE (((tblDailyWorkLog.WorkStatusCode)>"2") AND
((tblDailyWorkLog.DateWorked) Between [Enter Sunday of Week Again] And [Enter
Saturday of the Reporting Week]))
GROUP BY tblDailyWorkLog.UnitID;
Here is a list of the field names for my table to append to:
UnitID Text Size=4
WorkWeek Date/Time Format= ww
DailyHours Worked Number Double
VacationHours Number Double
HolidayHours Number Double
CompHoursUsed Number Double
InjuryHours Number Double
IllnessHours Number Double
Currently no Primay Key set. It will be UNITID + WORKWEEK.
The fields used in the query have the same data type and format as the table
to be appended to. The WorkWeek is coming from the DateWorked which is a
Date/Time field.
I can get the query to return the values I need when the query is shown in
the Datasheet view, but receive the errror message when I RUN the append
query.
Thanks for your help!
problem is. When I run the query, an error message about type conversion
failure, or key violation, or lock violation, or validation rule violation
appears.
Here is the SQL statment for the append query:
INSERT INTO tblWeeklyWorkedHours ( UnitID, VacationHours, HolidayHours,
CompHoursUsed, InjuryHours, IllnessHours, WorkWeek )
SELECT tblDailyWorkLog.UnitID, Sum(tblDailyWorkLog.VacationHours) AS
SumOfVacationHours, Sum(tblDailyWorkLog.HolidayHours) AS SumOfHolidayHours,
Sum(tblDailyWorkLog.CompHoursUsed) AS SumOfCompHoursUsed,
Sum(tblDailyWorkLog.InjuryHours) AS SumOfInjuryHours,
Sum(tblDailyWorkLog.IllnessHours) AS SumOfIllnessHours, Format([Date],"ww")
AS Week
FROM tblDailyWorkLog
WHERE (((tblDailyWorkLog.WorkStatusCode)>"2") AND
((tblDailyWorkLog.DateWorked) Between [Enter Sunday of Week Again] And [Enter
Saturday of the Reporting Week]))
GROUP BY tblDailyWorkLog.UnitID;
Here is a list of the field names for my table to append to:
UnitID Text Size=4
WorkWeek Date/Time Format= ww
DailyHours Worked Number Double
VacationHours Number Double
HolidayHours Number Double
CompHoursUsed Number Double
InjuryHours Number Double
IllnessHours Number Double
Currently no Primay Key set. It will be UNITID + WORKWEEK.
The fields used in the query have the same data type and format as the table
to be appended to. The WorkWeek is coming from the DateWorked which is a
Date/Time field.
I can get the query to return the values I need when the query is shown in
the Datasheet view, but receive the errror message when I RUN the append
query.
Thanks for your help!