I have a made a crosstab query in access which is causing me some heartache. The query works fine until I try and introduce an extra field as a row heading and group by. The field is “fldEquipmentType”.
The query actually runs, but then gives me an error of : “Datatype mismatch in criteria expression”.
A dialogbox comes up with the error message and when I press OK every cell in the query becomes “#Name?”
The SQL for the query is:
PARAMETERS [Forms]![frmReportDatesDialogBox]![BeginningDate] DateTime, [Forms]![frmReportDatesDialogBox]![EndingDate] DateTime;
TRANSFORM [fldPower]*Format(Count([fldStatusCode]),"0" AS TotalPower
SELECT [qryUtilisation&EquipmentCodesAllDepotsOnly].fldEquipmentType, [qryUtilisation&EquipmentCodesAllDepotsOnly].fldPower, Format(Avg([TotalPower]),"0.0" AS Average
FROM [qryUtilisation&EquipmentCodesAllDepotsOnly]
GROUP BY [qryUtilisation&EquipmentCodesAllDepotsOnly].fldEquipmentType, [qryUtilisation&EquipmentCodesAllDepotsOnly].fldPower
ORDER BY [qryUtilisation&EquipmentCodesAllDepotsOnly].fldPower
PIVOT Format([fldDate],"ddd" In ("Sun","Mon","Tue","Wed","Thu","Fri","Sat"
Please Note: the parameters are required to run the base query “qryUtilisation&EquipmentCodesAllDepotsOnly”
Can anyone suggest what is wrong?
Any help greatly appreciated.
John Baker