query for current month

R

rciolkosz

I have a full date.time stamp field and need a query to only pull records for
the current month and following month.
 
J

John Spencer

The Following should work

Field: YourDateField
Criteria: >= DateSerial(Year(Date()),Month(Date()),1) AND <
DateSerial(Year(Date()),Month(Date())+ 2,1)


OR if your field never has midnight as the time
Field: YourDateField
Criteria: Between DateSerial(Year(Date()),Month(Date()),1) AND
DateSerial(Year(Date()),Month(Date())+ 2,1)

John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
 
R

rciolkosz

I understand that. I want to use the computer time so that the query will
automatically display the current month plus the next.
 
M

Michel Walsh

DateDiff("m", now, yourDate) IN (0, 1)




will return true if your date is in the current month, or in the next month.



Hoping it may help,
Vanderghast, Access MVP
 
R

rciolkosz

AWESOME! PERFECT. Thank you

John Spencer said:
The Following should work

Field: YourDateField
Criteria: >= DateSerial(Year(Date()),Month(Date()),1) AND <
DateSerial(Year(Date()),Month(Date())+ 2,1)


OR if your field never has midnight as the time
Field: YourDateField
Criteria: Between DateSerial(Year(Date()),Month(Date()),1) AND
DateSerial(Year(Date()),Month(Date())+ 2,1)

John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
 

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