J
Jon
I have a query (reproduced below) that I run which pulls out from a
pair of tables the total of how much footage is run by a given machine
during a given shift, chosen by the user (cboProcess). Now I need to
modify that query so it only pulls out the last 5 production days worth
of data. The gotcha which is complicating it for me is two fold:
1. A given machine may run for up to 3 shifts during any day. As a
result, I can have between 5 and 15 entries for a given machine, and it
will not always be the same number for that machine.
2. A given machine may not run on consecutive days. So I can't simply
tell the query to take the most recent date, subtract 5 from it and
give me from that date forward.
Here's the query:
SELECT Format$(shift_calc.Date,'yyyymmdd') AS [Date By Day],
shift_calc.Shift_Num, Raw.process_nm, Sum(Raw.sqf) AS SumOfsqf
FROM Raw INNER JOIN shift_calc ON Raw.ID = shift_calc.ID
GROUP BY Format$(shift_calc.Date,'yyyymmdd'), shift_calc.Shift_Num,
Raw.process_nm
HAVING (((Raw.process_nm)=[forms]![frmsqftcombobox]![cboProcess]))
ORDER BY Format$(shift_calc.Date,'yyyymmdd') DESC;
Any suggestions on how to do what I want??
pair of tables the total of how much footage is run by a given machine
during a given shift, chosen by the user (cboProcess). Now I need to
modify that query so it only pulls out the last 5 production days worth
of data. The gotcha which is complicating it for me is two fold:
1. A given machine may run for up to 3 shifts during any day. As a
result, I can have between 5 and 15 entries for a given machine, and it
will not always be the same number for that machine.
2. A given machine may not run on consecutive days. So I can't simply
tell the query to take the most recent date, subtract 5 from it and
give me from that date forward.
Here's the query:
SELECT Format$(shift_calc.Date,'yyyymmdd') AS [Date By Day],
shift_calc.Shift_Num, Raw.process_nm, Sum(Raw.sqf) AS SumOfsqf
FROM Raw INNER JOIN shift_calc ON Raw.ID = shift_calc.ID
GROUP BY Format$(shift_calc.Date,'yyyymmdd'), shift_calc.Shift_Num,
Raw.process_nm
HAVING (((Raw.process_nm)=[forms]![frmsqftcombobox]![cboProcess]))
ORDER BY Format$(shift_calc.Date,'yyyymmdd') DESC;
Any suggestions on how to do what I want??