Click to See Complete Forum and Search --> : Filter an MS Access table by the month


ed7890
June 8th, 2005, 02:56 AM
I have a table of hits to a website and i have the date of the hits store as a short date. I want to create a report to show the hits to a page for the current month. How do i get just the month part of my dates and how would i get the current month. i have tried the month() function but i doesnt work right for me. Also how could i get it to diplay previous months

Vaderman
June 8th, 2005, 06:58 AM
Hi there,
I've had no problems in retrieveing the month using the method that you're using, but you maybe using it incorrectly.

Now, to retrieve a month from the date within MS Access, you would simply do the following:

MONTH(Anticipated_order_date)

So you can use something like the following, for example, to retrieve all records for a particular month:

SELECT * FROM <TableName> where MONTH(<DateColumn>) = 1..12


and to select all records prior to this month, you would simply use 'NOW', as in the following example:

SELECT * FROM <TableName> where MONTH(DateColumn) < Month(Now)


Hope that helps ya. ;)

Regards

John