Month to date query

H

hotplate

Hi,

I am trying to write a query that does a count of occurrances for each
day in a month starting on the first day of the month. How do you set
the criteria to the first day of the current month through the current
date? or the first day of the month though the last day of the month?
which ever is easier.

James
 
H

hotplate

I figured it out

Between DateSerial(Year(Date()),Month(Date()),1) And Date()

Thanks
 
J

John Spencer

And if you want the end of the month, you can use
DateSerial(Year(Date()),Month(Date())+1,0)
That works since the zero day of the next month is the last day of the
previous month. Or you can think of it as
DateSerial(Year(Date()),Month(Date())+1,1) - 1
Which can be restated thanks to the magic of DateSerial as
DateSerial(Year(Date()),Month(Date())+1,1-1)


Between DateSerial(Year(Date()),Month(Date()),1) And
DateSerial(Year(Date()),Month(Date())+1,0)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top