MS Access Year (date function ()

I am trying to create an MS Access query to give me the number of monthly records for the current year. The date field is text and the date is in format YYYY-MM. Everything I read says use Year(myDate) = 2014, but I get no results. I also tried Year(Date()), but again no results. Any ideas on what to do to run this query?

+3
source share
1 answer

One way to get a “monthly record count for the current year” would be

SELECT YearMonth, COUNT(*) AS RecordCount
FROM YourTable
WHERE YearMonth LIKE Year(Date()) & "*"
GROUP BY YearMonth

where [YearMonth] is your text column YYYY-MM.

+2
source

All Articles