Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql query problems

Status
Not open for further replies.

john12345

Technical User
Feb 28, 2002
4
US

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top