I have a tblJobs whose ID is JobID, then I have a tblRemainingHours that is in a many relationship to the tblJobs. Every week I will be entering new data into the tblRemainingHours.
I want to sort tblJobs for CurrentJobs=True and for each of these jobs I need to the the latest date and corresponding records from tblRemainingHours.
I used the: DMax("[RmgDate]","tblRemainingHours"
, but I just get the one job that has the most recent date in the RmgDate field instead of for each job.
There are a few other things going on here, but is the whole SQL statement:
SELECT tblRemainingHours.JobID, tblRemainingHours.RmgDate, [RmgProTrode]+[RmgProSteel]+[RmgProMoldBs]+[RmgHSMTrodes]+[RmgHSMSteel]+[RmgHSMMoldBs]+[RmgCNCTrodes]+[RmgCNCSteel]+[RmgCNCMoldBs]+[RmgWire]+[RmgCNCEDM]+[RmgCNCManualEDM]+[RmgManMach]+[RmgGrinding]+[RmgPolish]+[RmgFitting] AS RmgHours, Sum(tblHoursDetail.HoursDetail) AS Actual
FROM tblRemainingHours INNER JOIN tblHoursDetail ON tblRemainingHours.JobID = tblHoursDetail.JobID
WHERE (((tblHoursDetail.HoursDate)<=DMax("[RmgDate]","tblRemainingHours"
))
GROUP BY tblRemainingHours.JobID, tblRemainingHours.RmgDate, [RmgProTrode]+[RmgProSteel]+[RmgProMoldBs]+[RmgHSMTrodes]+[RmgHSMSteel]+[RmgHSMMoldBs]+[RmgCNCTrodes]+[RmgCNCSteel]+[RmgCNCMoldBs]+[RmgWire]+[RmgCNCEDM]+[RmgCNCManualEDM]+[RmgManMach]+[RmgGrinding]+[RmgPolish]+[RmgFitting]
HAVING (((tblRemainingHours.RmgDate)=DMax("[RmgDate]","tblRemainingHours"
));
Thanks in advance. Hopefully this is a simple task that I just don't know how to do.
I want to sort tblJobs for CurrentJobs=True and for each of these jobs I need to the the latest date and corresponding records from tblRemainingHours.
I used the: DMax("[RmgDate]","tblRemainingHours"
There are a few other things going on here, but is the whole SQL statement:
SELECT tblRemainingHours.JobID, tblRemainingHours.RmgDate, [RmgProTrode]+[RmgProSteel]+[RmgProMoldBs]+[RmgHSMTrodes]+[RmgHSMSteel]+[RmgHSMMoldBs]+[RmgCNCTrodes]+[RmgCNCSteel]+[RmgCNCMoldBs]+[RmgWire]+[RmgCNCEDM]+[RmgCNCManualEDM]+[RmgManMach]+[RmgGrinding]+[RmgPolish]+[RmgFitting] AS RmgHours, Sum(tblHoursDetail.HoursDetail) AS Actual
FROM tblRemainingHours INNER JOIN tblHoursDetail ON tblRemainingHours.JobID = tblHoursDetail.JobID
WHERE (((tblHoursDetail.HoursDate)<=DMax("[RmgDate]","tblRemainingHours"
GROUP BY tblRemainingHours.JobID, tblRemainingHours.RmgDate, [RmgProTrode]+[RmgProSteel]+[RmgProMoldBs]+[RmgHSMTrodes]+[RmgHSMSteel]+[RmgHSMMoldBs]+[RmgCNCTrodes]+[RmgCNCSteel]+[RmgCNCMoldBs]+[RmgWire]+[RmgCNCEDM]+[RmgCNCManualEDM]+[RmgManMach]+[RmgGrinding]+[RmgPolish]+[RmgFitting]
HAVING (((tblRemainingHours.RmgDate)=DMax("[RmgDate]","tblRemainingHours"
Thanks in advance. Hopefully this is a simple task that I just don't know how to do.