First, always consider what you are really trying to accomplish---to get all accounts this month, you can ask for everything between the first day of this month and the first day of next month minus one.....
OR you can just say WHERE Month(account_date) = Month(Date())
Second, I don't understand it, but
HAVING Month(account_date) = Month(Date())
gets both months and
WHERE Month(account_date) = Month(Date())
just gets the current month.
So, my query now does what I want, but I'd still like to know why the other one (HAVING) didn't.
The only criteria in the "HAVING..." clause should reference the aggregated value. This would be used like:
HAVING Sum([TotalCost]) >2000
Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.