Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code for first/last day of last full month? 2

Status
Not open for further replies.

loveyoursite

Technical User
Apr 14, 2005
100
US
CRV10 - I have a monthly turnover report that has a start date and stop date parameter. I have just found out that in order to schedule the report to automatically run (with the system we are using) the report can not have any user entered parameters. I am having to change my report to “last full month” but all of my running totals used the start and stop date parameters. For example:

{EMPLOYEE.TERM_DATE} >={?Start Date} and
{EMPLOYEE.TERM_DATE} <={?Stop Date} and
{PCODES.CODE} = "03" and
{VW_TERMINATES_REASONS.FIELD_NAME} <> "RESIGNATION"

Everywhere I have used {?Stop Date} now needs to use the last day of the last full month, and the {? Start Date} needs to be the first day of the last full month.

Could someone please help me with a revised formula? I don’t know how to code “last day of the last full month” and “first day of the last full month”. Could you please use the above example in your answer if possible?

Thanks!
 
You can just get the calendar month: month({your.date}) = month(currentdate)-1

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
Code:
{EMPLOYEE.TERM_DATE} >= Minimum(LastFullMonth) and
{EMPLOYEE.TERM_DATE} <= Maximum(LastFullMonth) and
{PCODES.CODE} = "03" and
{VW_TERMINATES_REASONS.FIELD_NAME} <> "RESIGNATION"
 
Excellent, thanks so much Naith, that worked perfectly!

Do you by any chance know the formula for printing that date range? I want to print the date range for whatever the last full month is, for example: May 1, 2005 through May 31, 2005.

Thanks again!
 
Code:
ToText(minimum(lastfullmonth),"MMM dd, yyyy") + " through " + ToText(minimum(lastfullmonth),"MMM dd, yyyy")
 
Er, that last bit should read maximum, not minimum.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top