Error message: Invalid argument to function

I get the above error when running the following query

SELECT Sum(IIf([vat],[takings]/[rate],[takings])) AS Total, DatePart('ww',[weekendingdate],2,2) AS WeekNo, Year([getVAT_Rate]![weekendingdate]) AS [Year]
FROM [business units] INNER JOIN (departments INNER JOIN getVAT_Rate ON departments.department = getVAT_Rate.department) ON [business units].buID = departments.bus_unit
WHERE (((cint(DatePart('yyyy',[weekendingdate])))=cint(2013)))
GROUP BY DatePart('ww',[weekendingdate],2,2), Year([getVAT_Rate]![weekendingdate]);

getVAT_Rate is another query as follows

SELECT (select top 1 VAT_Rate from VAT_Rates where VAT_Rates.VAT_Date <= t.ZTotalDate order by VAT_Rates.VAT_Date desc) AS Rate, * FROM [n-weeklytransactions] AS t;

The error does not point to a part of the query.

Regards

Pete

July 9th, 2013 1:41pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics