Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Query Parameter Question

1 view
Skip to first unread message

Todd D. Levy

unread,
Aug 3, 2003, 4:22:52 PM8/3/03
to
I have a query based report with (among others) has a date field.

I want to setup the criteria for this date field so that when the report
is run it automatically chooses the start date and end date of the
previous month based on the current month that the report is being run
in.

For example, if I run the report today (Aug 3, 2003), the criteria will
automatically run the report from 7/1/03 through 7/31/03 based on July
being the previous month.

Is this possible, and if so how?

Rick Brandt

unread,
Aug 3, 2003, 4:37:23 PM8/3/03
to
"Todd D. Levy" <usenet00...@spamex.com> wrote in message
news:MPG.19973924...@nyc.news.speakeasy.net...

WHERE DateFieldName BETWEEN DateSerial(Year(Date()), Month(Date()) - 1, 1) AND
DateSerial(Year(Date()), Month(Date()), 0)


Todd D. Levy

unread,
Aug 3, 2003, 10:13:35 PM8/3/03
to
In article <bgjrpt$pata4$1...@ID-98015.news.uni-berlin.de>,
rvtjb...@sbcglobal.net says...

Thanks Rick, that did the trick.

Noel

unread,
Aug 4, 2003, 10:18:17 AM8/4/03
to
Can I ask similar question? If you ran the report and
wanted records for the previous year, what would the code
be? eg the End date would be the current date, 4th Aug
2003 and the Start Date would be 4th Aug 2002 (or would
that be 5th Aug? - it would not be crucial anyway).
Thanks, Noel

>.
>

John Spencer (MVP)

unread,
Aug 4, 2003, 11:20:26 AM8/4/03
to
Two ways to get the date a year ago are.

DateAdd("yyyy",-1,Date())

or

DateSerial(Year(Date())-1,Month(Date()),Day(Date()))

Noel

unread,
Aug 5, 2003, 5:36:38 AM8/5/03
to
Thanks, Noel
>.
>
0 new messages