Query criteria to select first day of current month

R

rocketD

Hello,

I have a query that I'd like to select all data from a table where the
date is >= the first day of the current month, one year ago. For
example, March is the current month, and I want all data from the
table from 3/1/2008 onward. I need it to be a rolling window, so that
when it gets to April, the query automatically selects data from
4/1/2008. I don't want to worry about setting up VB code, I just want
to put it in the criteria of the query. Can it be done? I tried
already making variables choosing the current month, with Month(Now
()), and year, with Year(Now()), but I can't figure out how to get the
first day of the month.

Thanks!
 
R

rocketD

Hello,

I have a query that I'd like to select all data from a table where the
date is >= the first day of the current month, one year ago.  For
example, March is the current month, and I want all data from the
table from 3/1/2008 onward.  I need it to be a rolling window, so that
when it gets to April, the query automatically selects data from
4/1/2008.  I don't want to worry about setting up VB code, I just want
to put it in the criteria of the query.  Can it be done?  I tried
already making variables choosing the current month, with Month(Now
()), and year, with Year(Now()), but I can't figure out how to get the
first day of the month.

Thanks!

Actually, never mind, sorry, someone told me about DateSerial. I used
this in the date field of the query, and it worked like a charm:
 

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