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!

Auto Title with date range

Status
Not open for further replies.

RepRider

Technical User
Jan 25, 2007
114
US
CRXI - SQL server

I currently us the above as a formula that displays in the report header. However, I need it to be the actual date range selected for the report. With my formula it shows the min and max of data within the date range.

My current forumla is @DateRange:

"For the Period " + ToText (Minimum({Service_Time_DMC.begin_date}),"MMMM d, yyyy" )+ " to " +
ToText (Maximum({Service_Time_DMC.begin_date}),"MMMM d, yyyy" )

Any help is appreciated!
 
If you have a date range parameter {?daterange}, just substitute it for {Service_Time_DMC.begin_date} in your formula.

-LB
 
Hmm I don't have any parameters set. Is there another way?
 
Sorry for the confusion, I am only semi-proficient in Crystal! :)

I use the select expert to stipulate the date range I want to use for the report, lets say October 1, 2007 to October 31, 2007. But services may not occur on every date in that date range. When I use the date range formula above to put in the title it doesn't show October 1 as the beginning of the date range in the title if no service occurred on that date. So it may say October 3, 2007 to October 29, 2007.

How do I make the title of the report show the date range that I specified in the select expert without entering it manually each time?

I took the term parameter to be one that is set up for another person to enter to change the date ranges.

I hope I made it clearer.
 
The only way to do this is to either use a range parameter as Ido suggested, or, if you are hard coding the date in the selection formula, do the same in the title formula.

Or, if you are trying to make the report title always reflect the beginning of the month/end of the month because that is how you set up your hard coded date range in the selection formula, then you could adapt your original formula to:

"For the Period " + ToText (Minimum({Service_Time_DMC.begin_date})-day(minimum({Service_Time_DMC.begin_date}))+1,"MMMM d, yyyy" )+ " to " +
ToText (dateadd("m",1,Maximum({Service_Time_DMC.begin_date}))-day(dateadd("m",1,Maximum({Service_Time_DMC.begin_date}))),"MMMM d, yyyy" )

-LB
 
Thank you lbass, that is just what I needed! I will use the other way at times also, now that I know how. :)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top