Microsoft access query date criteria for a month

sxxgupta
sxxgupta used Ask the Experts™
on
I need do write criteria in my Access select query to retrieve data between two dates.

The beginning date is to be the first date of the current month.
The end date is to be the last date of the current month.

How do I do this?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016
Commented:


you can do this

select * from tableX
where year([DateField])=year(Date()) and Month([Datefield])=Month(Date())

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
Here is an example:

SELECT Table1.*
FROM Table1
WHERE (((Table1.MyDate) Between Month(Date()) & "-" & "1-" & Year(Date()) And DateAdd("m",1,Month(Date()) & "-" & "1-" & Year(Date()))-1));


mx
Top Expert 2016

Commented:
or
select * from tableX
where [dateField] between dateSerial(Year(Date), Month(Date), 1) and dateSerial(Year(Date), Month(Date) + 1, 0)


Author

Commented:
Awesome.  Thank you.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial