I have the below piece of code as criteria in a query. For some reason I keep getting a type mismatch error! I checked the table and the field is formatted to Date/Time. Can someone please lay a fresh set of eyes on this? Thank you.
Code:
Between CDate(IIf(DatePart("m",Date())=1,CDate("12/31/" & DatePart("yyyy",Date())-1),CDate(DatePart("m",Date())-1 & "/1/" & DatePart("yyyy",Date())))) And CDate(IIf(DatePart("m",Date())=1,CDate("12/31/" & DatePart("yyyy",Date())-1),CDate(DatePart("m",Date())-1 & "/31/" & DatePart("yyyy",Date()))))