hceonetman
Technical User
Using Access 2000 I have two tables that list empl. absences - Absences lists hours by date, Reasons lists a reason code, i.e. sick, vacation, etc. The relationship is many (absences) to one (reasons), that is a single reason may relate to an absence of more than one day.
I have a query (REASONS_NF) that totals sick time by employee ID as follows:
SELECT Reasons.ReasonCat, Reasons.PayID, Reasons.ReasonID
FROM Reasons
WHERE (((Reasons.ReasonCat)="Sick"
AND ((Reasons.ReasonType)<>"08-FamilyDeath" Or (Reasons.ReasonType) Is Null));
This query works as intended. I then sum total hours absent with the query TAKEN_NF_SICK_HOURS_YTD:
SELECT Reasons_NF.PayID, Sum(Absences.Hours) AS SumOfHours
FROM Reasons_NF INNER JOIN Absences ON Reasons_NF.ReasonID = Absences.ReasonID
GROUP BY Reasons_NF.PayID;
The results of this query are also what I expect. I'd now like to update a field in a table with the total hours. I tried:
UPDATE Updt_BaseDate, [Taken_NF_Sick_Hours_YTD] SET Updt_BaseDate.Tot_Sick_Hours = [Taken NF_Sick Hours YTD]![SumOfHours];
The result is "Operation must use an updateable query." It appears an Access query may not reference an aggregate from one query in a subsequent query. How do I get the total hours into the second query? I also tried not totaling the value in the middle query and using the domain function DSUM in the third query, but my syntax must have been off. It not only failed, it locked up Access.
Any help would be appreciated. I hope I've provided enough info.
HCEONETMAN
If today was a fish, I'd throw it back.
I have a query (REASONS_NF) that totals sick time by employee ID as follows:
SELECT Reasons.ReasonCat, Reasons.PayID, Reasons.ReasonID
FROM Reasons
WHERE (((Reasons.ReasonCat)="Sick"
This query works as intended. I then sum total hours absent with the query TAKEN_NF_SICK_HOURS_YTD:
SELECT Reasons_NF.PayID, Sum(Absences.Hours) AS SumOfHours
FROM Reasons_NF INNER JOIN Absences ON Reasons_NF.ReasonID = Absences.ReasonID
GROUP BY Reasons_NF.PayID;
The results of this query are also what I expect. I'd now like to update a field in a table with the total hours. I tried:
UPDATE Updt_BaseDate, [Taken_NF_Sick_Hours_YTD] SET Updt_BaseDate.Tot_Sick_Hours = [Taken NF_Sick Hours YTD]![SumOfHours];
The result is "Operation must use an updateable query." It appears an Access query may not reference an aggregate from one query in a subsequent query. How do I get the total hours into the second query? I also tried not totaling the value in the middle query and using the domain function DSUM in the third query, but my syntax must have been off. It not only failed, it locked up Access.
Any help would be appreciated. I hope I've provided enough info.
HCEONETMAN
If today was a fish, I'd throw it back.