Wednesday, March 28, 2012

Report parameter - First day of last month/last day of month

can somebody pls. help me with the following report parameter defaults?
for a monthly report I need two dates as parameter defaults:
The first day of the last month
and
the last day of last month
If I run a report on - let's say March 1st, I can get the last day of the
last month with
=Today.AddDays(-1)
and the first day of the last month with
=Today.AddMonths(-1)
However, I need these paramers to work every day. For example, I want to be
able to run the report on March 3rd or March 15th, and the report should also
have February 1st and February 28th as start and end dates.
How can I do this?
Thank you for helping,
MartinHi Martin,
This will work everyday. start and end date of last month.
start date - str(year(today)) + "/" + str(month(today)-1) + "/1"
End Date - dateadd("d",-1, (str(year(today)) + "/" + str(month(today)) +
"/1"))
Now the date format ie dd/mm/yy or mm/dd/yy etc... I hope you can change it.
Amarnath
"Martin" wrote:
> can somebody pls. help me with the following report parameter defaults?
> for a monthly report I need two dates as parameter defaults:
> The first day of the last month
> and
> the last day of last month
> If I run a report on - let's say March 1st, I can get the last day of the
> last month with
> =Today.AddDays(-1)
> and the first day of the last month with
> =Today.AddMonths(-1)
> However, I need these paramers to work every day. For example, I want to be
> able to run the report on March 3rd or March 15th, and the report should also
> have February 1st and February 28th as start and end dates.
> How can I do this?
> Thank you for helping,
> Martin
>

No comments:

Post a Comment