Showing only current month records in a query

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

Guest

I have a D-base using a date field and I would like to know if there is a way
to show the current month records only in my query without changing the
criteria every month. Is there an expression that would help me accomplish
this?

thanks.
 
Add a new column to the query and put something like the following....

MonthOfData: Format([YourDateFieldNameHere],"mmyy")

Then under that (in your criteria) put...


= Format(Date(),"mmyy")


If you don't want to see this when you run the query, uncheck the display
checkbox for that column.



Rick B
 
I have a D-base using a date field and I would like to know if there is a way
to show the current month records only in my query without changing the
criteria every month. Is there an expression that would help me accomplish
this?

thanks.

Rick's suggestion is one way; another - useful if you have a large
table, since it will use the index on the date/time field - would be a
criterion of
= DateSerial(Year(Date()), Month(Date()), 1) AND < DateSerial(Year(Date()), Month(Date()) + 1, 1)


John W. Vinson[MVP]
 

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