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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help with Dates 2

Status
Not open for further replies.

dcrosier

Instructor
Mar 17, 2000
51
US
My select criteria is &quot;in the period of the last full month&quot;.&nbsp;&nbsp;I want to reflect the proper Month description in the report Title. If I ran the report today (7/28), I want to see the information from June 1, to June 30.&nbsp;&nbsp;I would like a calculated field that allows me to just &quot;re-run&quot; the report at each month end and reflect the proper month.&nbsp;&nbsp;Right now, I am editing a text field which is not very efficient.<br><br>Thanks.<br>
 
As I understand your question, you have a report which is using the 'LastFullMonth' function within crystal to find all records with a date in the last month, and all you need a string containing the Name of that reporting month.<br><br>If so, the only way I can think of is to create a function containing an array of the 12 month names, plus an array location identifier of Month(CurrentDate)-1.&nbsp;&nbsp;The following string seems to work OK :<br><br>['January','February','March','April','May','June','July','August','September','October','November','December'][Month(CurrentDate)-1]<br><br>This returns the name of last month, which fits in with the 'LastFullMonth' function.<br><br>Hope it helps<br><br>Chris.
 
Oops - Me again.&nbsp;&nbsp;The last formula doesn't work in January.<br><br>The correct one takes the current month as the array location for the description of the month before ie.<br><br>If current month = 1 (Jan), show the name December, if month = 2 (Feb) show January .......<br><br>It should read then :<br><br>['December','January','February','March','April','May','June','July','August','September','October','November'][Month(CurrentDate)]<br><br>Sorry about that<br><br>Chris
 
Date(Year(CurrentDate),Month(CurrentDate),1)-1<br>will always get you a date which is the last day of the prior month, even when your report has no data for that month.&nbsp;&nbsp;Format it to show only the Month name, put it in the report header. <p>Malcolm Wynden<br><a href=mailto:wynden@island.dot.net>wynden@island.dot.net</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top