Code:
PARAMETERS [Forms]![frm_Chart]![txt_FromDate] DateTime, [Forms]![frm_Chart]![txt_TillDate] DateTime;
TRANSFORM Nz(Sum([Production]),0) AS Expr2
SELECT tbl_Production.[MOD], tbl_Production.Machine, tbl_Production.Shift
FROM tbl_Production INNER JOIN tbl_Shift ON tbl_Production.Shift = tbl_Shift.Shift
WHERE (((tbl_Production.ProductionDate) Between [Forms]![frm_Chart]![txt_FromDate] And [Forms]![frm_Chart]![txt_TillDate]))
GROUP BY tbl_Production.[MOD], tbl_Production.Machine, tbl_Shift.Shift_Order, tbl_Production.Shift
PIVOT Format([ProductionDate],"yyyymmdd ddd");
I just solved this question, but it seems worth asking anyway. This query runs almost perfectly, EXCEPT that the NZ function coverts the value Sum([Production]) into text. This does not happen in a selection query on the same data. My solution was to bracket the formula with a Clng function, but why does this happen in the first place?

Any ideas?