I've got a simple query against a single table and need to return records from the previous month. Searches have led me to believe that DateSerial is the way to go, but I've got an issue with it finding the last day of the prior month.
Running Access 2019 on Win10.
The following returns 11/1/2019 - 11/29/2019 but the table contains records for 11/30. The field IncidentDateTime is datetime.
WHERE IncidentDateTime Between DateSerial(Year(Date()),Month(Date())-1,1) And DateSerial(Year(Date()),Month(Date()),0)
This returns 11/30 - 12/4.
IncidentDateTime >= DateSerial(Year(Date()),Month(Date()),0)
This returns 11/29 and prior.
IncidentDateTime <= DateSerial(Year(Date()),Month(Date()),0)
And this returns nothing.
IncidentDateTime= DateSerial(Year(Date()),Month(Date()),0)
Obviously I'm missing something!
Running Access 2019 on Win10.
The following returns 11/1/2019 - 11/29/2019 but the table contains records for 11/30. The field IncidentDateTime is datetime.
WHERE IncidentDateTime Between DateSerial(Year(Date()),Month(Date())-1,1) And DateSerial(Year(Date()),Month(Date()),0)
This returns 11/30 - 12/4.
IncidentDateTime >= DateSerial(Year(Date()),Month(Date()),0)
This returns 11/29 and prior.
IncidentDateTime <= DateSerial(Year(Date()),Month(Date()),0)
And this returns nothing.
IncidentDateTime= DateSerial(Year(Date()),Month(Date()),0)
Obviously I'm missing something!