View Full Version : urgent help with dates


mistaking
05-04-2002, 03:51 AM
I need to build a query that shows all invoices for the current month a year ago.
What i want to do is prompt for the current date(not a problem).
Then I think I need to somehow take a year away from this date and look for all the invoices for that year in the current month only.
Does anyoone know how I would form such a query?

DBL
05-04-2002, 06:21 AM
In the criteria for the date field you would need to use the DateSerial function:

Between (DateSerial(Year(Date()-1),Month(Date(),1),Day(Date())) and DateSerial(Year(Date()-1),Month(Date()+1,1),Day(Date()))

I haven't tested this so you may need to fiddle with it. Search the forum on DateSerial - there's quite a bit that would help you solve it.

mistaking
05-04-2002, 07:28 AM
Thanks the answer was a lot simpler, what i used was - Field: Year([date field])
Criteria: Year([Enter date])-1