Home > Net >  Why am I getting a "type mismatch" error in my Accessdb query?
Why am I getting a "type mismatch" error in my Accessdb query?

Time:09-17

I am running a query in Access Database that should aggregate information based on year, month, and type. I set it up so that for the month, it would read the MonthName(InfoDate,1) to return the abbreviated month name. When I have all the query items in the query except the summation, it will run. As soon as I through the summation in, I get a "Type Mismatch." upon troubleshooting, I found that the issue was with the MonthName(InfoDate,1). If I remove the MonthName(InfoDate,1) and only include the Month(InfoDate) the query runs as expected. I want to keep the MonthName(InfoDate,1) in the query so that it is easily discernible as to what month we are discussing because the fiscal year does not start on Jan 1.

Thoughts on how to fix the "Type Mismatch." and run the query as expected?

CodePudding user response:

It's the name of a month, not of a date, so (True or False as second parameter):

MonthName(Month(InfoDate), True)

To handle fiscal years, study module DateBank.bas at VBA.Date.

  • Related