What's the purpose of Datediff('d',theMonth," & [CurrentMonth] & ")>0")?
I suspect there's an easier way of arriving at the same thing.
I note that you missed my comment that you can't refer to computed
fields by name like that: you have to repeat the calculation.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
message Thanks Doug,
I have ammended the code to exclude the month keyword but it still
doesn't seem to be working. Any further ides.
I was wonderring if it could be something to do with the date format
but both dates are worked out in the same way.
I have copied the new code below.
Any further advice would be greatly appreciated.
Thanks
SELECT DateAdd("d",1-Day([Date Raised]),[Date Raised]) AS CurrentMonth,
DSum("[Queries Closed]","qryStatsTotalClosed","Datediff('d',theMonth,"
& [CurrentMonth] & ")>0") AS RunTot
FROM tblQueryInfo;
message Month is a reserved word, and shouldn't be used as a field name, and
you can't refer to computed fields like that in queries: you need to
repeat the calculation.
For a good discussion on names to avoid for fields and variables, see
what Allen Browne has at
http://www.allenbrowne.com/AppIssueBadWord.html
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
message Can anyone see the problem with my Running Total Query below?
(I have used the same formula for Month on the query
qryStatsTotalClosed as CurrentMonth on this one)
Thanks in advance,
John
SELECT DateAdd("d",1-Day([Date Raised]),[Date Raised]) AS
CurrentMonth, DSum("[Queries
Closed]","qryStatsTotalClosed","Datediff('d',Month," & [CurrentMonth]
& ")>0") AS RunTot
FROM tblQueryInfo;