Reputation: 63
I am having an issue with Ms Access 2010 processing Dates using the Month and Year functions. Oddly enough the day function works...
?Day(#12/25/2014#)
25
?Month(#12/25/2014#)
error
?Year(#12/25/2014#)
error
The error I am getting is a Run-time Error '13' / Type Mismatch. An help diagnosing he root cause or a solution would be appreciated.
Upvotes: 0
Views: 1052
Reputation: 1930
I suspect Month and Year have been redefined in your code.
Try typing just the 7 characters ?month(
into the debug window without pressing Enter, and see what the IntelliSense tip pops up with.
If it says Month(Date)
then all is working fine.
If it says something like Local Month As Variant
then that is what you need to fix.
This code reproduces your problem, complete with the same error message:
Public Sub MonthFail()
Dim Month, x
x = Month(#12/25/2014#)
End Sub
Upvotes: 2