Showing only current month records in a query

G

Grankioto

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.
 
R

Rick B

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
 
J

John Vinson

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]
 
Top