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

Calculating Dates

Status
Not open for further replies.

Stuartp

Technical User
Feb 22, 2001
178
GB
I'm new to Crystal Reports (just started using 4.6) and I am wondering how to make it calculate the value of months. I have 6 columns of data in my report, and I want to place the name of the corresponding month and year at the top of each. The first column should have the current month and year, the next column should have the month (and year if appropriate) before etc so i might have March 01 | February 01 | January 01 | December 00 this month, and when I run the report next month it would print April 01 | March 01 | February 01 etc as the column headers.

Thanks in advance,

Stuart
 
This should get you started:

The function Today gives you the current date in your version.

See FAQ 1.B for a formula that will allow you to add a number of months to any date. You will need one formula for each month column.

Once you have the dates for each month, getting them to print the Year is simply using the YEAR function. The Month will require the Month() function and a nested IF-THEN to turn it into text. Unfortunately the date formatting for dates in 4.5 (and I think it is the same in 4.6) doesn't allow you to shut off the day. So you have to use a formula Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top