dates dilemma

G

Guest

I have a database from 1/1/02 until today. I would like
to run a report depending on when it is run. So, if I ran
the report today,

I want to look at 1yr data ending on the last day of
previous month (eg - 7/31/04). So, the start date should
be (8/1/03).

I am creating a complex algorithm and think there should
be a better way to do it.

Any ideas ???

Thanks
 
R

Rick Brandt

I have a database from 1/1/02 until today. I would like
to run a report depending on when it is run. So, if I ran
the report today,

I want to look at 1yr data ending on the last day of
previous month (eg - 7/31/04). So, the start date should
be (8/1/03).

I am creating a complex algorithm and think there should
be a better way to do it.

Any ideas ???

Thanks

BETWEEN DateSerial(Year(Date()), 1, 1) AND DateSerial(Year(Date()),
Month(Date()), 0)


If the date field being filtered also includes time then use...

BETWEEN DateSerial(Year(Date()), 1, 1) AND DateSerial(Year(Date()),
Month(Date()), 1)
 
F

fredg

I have a database from 1/1/02 until today. I would like
to run a report depending on when it is run. So, if I ran
the report today,

I want to look at 1yr data ending on the last day of
previous month (eg - 7/31/04). So, the start date should
be (8/1/03).

I am creating a complex algorithm and think there should
be a better way to do it.

Any ideas ???

Thanks

As criteria on the DateField:

Between DateSerial(Year(Date())-1,Month(Date()),1) and
DateSerial(Year(Date()),Month(Date()),0)

8/1/2003 to 7/31/2004
 
R

Rick Brandt

Fred's response is correct. I was thinking you wanted Year-to-date ending
last month rather than a year's worth of data ending last month.
 
G

Guest

Thank you both!
-----Original Message-----


As criteria on the DateField:

Between DateSerial(Year(Date())-1,Month(Date()),1) and
DateSerial(Year(Date()),Month(Date()),0)

8/1/2003 to 7/31/2004
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
.
 

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

Top