Crystal reports format number

Posted on 2008-01-25
Medium Priority
Last Modified: 2010-04-21
I have the following problem when the value is returned to the screen the number show like 2,009 how do I rid of the comma? Is there a format function?

Dim MonthInt as number
Dim MonthString as String
Dim yearString as Number
MonthInt = Month({StaffProjVar;1.Begin date})

MonthInt = (MonthInt + 11)

If (Monthint) <= 12 then
    MonthString = MonthName(MonthInt)
    MonthInt = MonthInt - 12
    MonthString = MonthName(MonthInt)
    YearString = (Year({StaffProjVar;1.Begin date}) + 1)
End If  

Formula = (MonthString + " " + (Cstr(YearString)))
Question by:Mittensonmaui
LVL 71

Expert Comment

by:Éric Moreau
ID: 20745571
You can format your object by right-clicking on it, select Format Object, and from the Number tab, select the format without the comma -1123

Author Comment

ID: 20745631
Unfortunately the Formula is returning a string so the number tab is not an option.
I need to fromat it before it is returned.
LVL 71

Expert Comment

by:Éric Moreau
ID: 20745811
have you tried:
Formula = (MonthString + " " + replace(Cstr(YearString),',',''))
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!


Author Comment

ID: 20747988
Still didn't work, It seems as though the field is being converted to currency on tyhe yeild function this is CR 2008 maybe it is a bug?
LVL 101

Expert Comment

ID: 20747992
You can use the CStr to not insert the ,


LVL 16

Expert Comment

ID: 20758987
mlmcc's solution will work or you can do a totext(YearString,'0')
LVL 28

Accepted Solution

bdreed35 earned 1000 total points
ID: 20759008

You can streamline this formula to one line and get the result you want like this:

formula = cstr(dateadd("m",11,{StaffProjVar;1.Begin date}),"MMMM yyyy")

There is no need to break things down into months and years.  You can just add 11 months to the date, then format it MonthName and Year using the CStr function

Author Closing Comment

ID: 31425086
Great thanks

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
There may be issues when you are trying to access Outlook or send & receive emails or due to Outlook crash which leads to corrupt or damaged PST file. To eliminate the corruption from your PST file, you need to repair the corrupt Outlook PST file. U…

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question