how to select current month in a query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

everytime i open this query i want it to select the current month of a date
field instead of having to put between 1/1/2006 and 1/31/2006 in the
criteria section
 
If you are coding it in SQL view
Month(Date()) As CurrMonth

If you are using the query builder. Put this in the Field row where you
want it to show:
CurrMonth: Month(Date())
 
everytime i open this query i want it to select the current month of a date
field instead of having to put between 1/1/2006 and 1/31/2006 in the
criteria section

The current month "July" is fine, but of what year?

I would suspect you want only the current month AND current year.

Where Format([DateField],"mm/yyyy") = Format(Date(),"mm/yyyy")
 
Assumptions:
-- the date field is a datetime field
-- The date field contains only dates without times.

Field: YourDateField
Criteria: 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

Back
Top