genomon, I thank you for your help but am having some trouble. I'm probably doing something wrong but I'm getting the error "Data type mismatch in criteria expression." I'm assuming there's a data type somewhere that needs to be changed but I don't know where. Or maybe I'm doing this all wrong. In the field name I put: TxnValue:Format([PUB_PV_InvHistory].[TxnValue],"$##,###.##"). For some reason when I try to run it, it changes $##,###.## to $#,###.## taking out the ten thousands place '#'. I don't know if that's relavent but I thought I would bring it up. Any thoughts?
PHV, here is my SQL code before genomon's suggestion:
SELECT PUB_PV_Customer.CustName, PUB_PV_InvHistory.SOrderNum, PUB_PV_InvHistory.SOrderLineNum, Sum(PUB_PV_InvHistory.TxnValue) AS SumOfTxnValue, PUB_PM_Item.ItemTypeCode, PUB_PM_Item.BrandCode INTO costs
FROM (PUB_PV_InvHistory INNER JOIN PUB_PM_Item ON (PUB_PV_InvHistory.ItemCode = PUB_PM_Item.ItemCode) AND (PUB_PV_InvHistory.CompNum = PUB_PM_Item.CompNum)) INNER JOIN PUB_PV_Customer ON (PUB_PM_Item.CompNum = PUB_PV_Customer.CompNum) AND (PUB_PM_Item.CustCode = PUB_PV_Customer.CustCode)
WHERE (((PUB_PM_Item.ProdGroupCode)="Flexo" Or (PUB_PM_Item.ProdGroupCode)="WebOff" Or (PUB_PM_Item.ProdGroupCode)="Offset") AND ((PUB_PV_InvHistory.TxnDate) Between #5/1/2009# And #5/31/2009#) AND ((PUB_PV_InvHistory.TxnType)=8 Or (PUB_PV_InvHistory.TxnType)=9))
GROUP BY PUB_PV_Customer.CustName, PUB_PV_InvHistory.SOrderNum, PUB_PV_InvHistory.SOrderLineNum, PUB_PM_Item.ItemTypeCode, PUB_PM_Item.BrandCode;
And if it could help, here it is after when I get the data type error:
SELECT PUB_PV_Customer.CustName, PUB_PV_InvHistory.SOrderNum, PUB_PV_InvHistory.SOrderLineNum, Sum(Format([PUB_PV_InvHistory].[TxnValue],"$#,###.##")) AS TxnValue, PUB_PM_Item.ItemTypeCode, PUB_PM_Item.BrandCode INTO costs
FROM (PUB_PV_InvHistory INNER JOIN PUB_PM_Item ON (PUB_PV_InvHistory.ItemCode = PUB_PM_Item.ItemCode) AND (PUB_PV_InvHistory.CompNum = PUB_PM_Item.CompNum)) INNER JOIN PUB_PV_Customer ON (PUB_PM_Item.CompNum = PUB_PV_Customer.CompNum) AND (PUB_PM_Item.CustCode = PUB_PV_Customer.CustCode)
WHERE (((PUB_PM_Item.ProdGroupCode)="Flexo" Or (PUB_PM_Item.ProdGroupCode)="WebOff" Or (PUB_PM_Item.ProdGroupCode)="Offset") AND ((PUB_PV_InvHistory.TxnDate) Between #5/1/2009# And #5/31/2009#) AND ((PUB_PV_InvHistory.TxnType)=8 Or (PUB_PV_InvHistory.TxnType)=9))
GROUP BY PUB_PV_Customer.CustName, PUB_PV_InvHistory.SOrderNum, PUB_PV_InvHistory.SOrderLineNum, PUB_PM_Item.ItemTypeCode, PUB_PM_Item.BrandCode;
In this particular make table query, the only field I'm trying to format is the TxnValue field.