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

Format Help

Status
Not open for further replies.

BradW

IS-IT--Management
Nov 30, 2000
126
0
0
US
Good Morning,

I have a formula that is for a title on a report, however, I'm having trouble formatting the year in this. Database is SQL Server.

______________Start Formula_____________

StringVar MO:=["January","February","March","April","May","June","July","August","September","October","November","December"]
[Month({@Call Date for Select})];
StringVar YR:=ToText(Year({@Call Date for Select}),"0000",0);

"Calls to Campus Emergency Phones in " + MO + ", " + YR

_______________End Formula______________

The formula @Call Date for Select takes a date/time field in the database and converts it to date only. It is then used in the select statement, where it is "in the period" of the "last full month"

I am getting the results that I want, except the year is coming out as 2,010 and I want 2010, of course.

I've done this formatting before but can't seem to make this work.

ALso, I'm running the report in an automated report program, not Crystal, so while I can change the number format in Crystal to eliminate commas, I don't have this control in the product that I'm using to automate the report, so I need to format out the comma in the RPT file itself.

Thanks for all help!
 
StringVar YR:=ToText(Year({@Call Date for Select}),"0000");

This should return 2010.

But why not just use a formula like this for the report title:

"Calls to Campus Emergency Phones in " +
totext(minimum(lastfullmonth),"MMMM, yyyy")

-LB
 
Thanks, I always learn a new way to do things here!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top