microsoft access help database programing developer
Back to Access Experts About Access Experts Access Experts Websites Access Experts Team Access Experts Services Access Experts Case Studies Access Expert Tips Contact Access Experts OUR BLOG
 
 
Criteria for the current month in a query
by Juan Soto
11/05/2009

Use one single line to return all records for the month
The other day I needed to create a query where it returns all records with dates for the current month. I did not want to hard code the beginning and ending dates in the query, so I came up with the following line of code you can paste into your query:

Between CDate(Month(Date()) & "/1/" & Year(Date())) And DateAdd("m",1,CDate(Month(Date()) & "/1/" & Year(Date())))-1

The criteria line above uses the "Between And" operators to calculate the first of the month and the end of the month of the current date. Enjoy!

If you like this tip you will be delighted with our service! Call or write us today for a free quote regarding your computer needs.

Publish this article in your own corporate newsletter or publication! Contact us to obtain a free license.


Home | About Us Why PCExperts | Team | Services | Newsletter | Contact Us
Copyright © 2004