njvyas007
asked on
Custom Seperators for the Number Format
I am using VB 6.0 and Crystal Report 8.0 I have developed an application and with the help of the Crystal Report, I am printing my Reports. My problem is that whenever I am displaying or printing a number or a currency data the format of that data is "1,000,000" or "1,00,00,00", but this is not what I want. The format I require is "10,00,000", I tried a lot of things but am not able to get it. So can u plz tell me some solution for this.
Hi njvyas007,
A little more information please:
Can the field have less than 6 digits, such as 1000 (to be formatted as 1,000???)
Can the field have more than 7 digits. If so, how does it get formatted?
Dabas
A little more information please:
Can the field have less than 6 digits, such as 1000 (to be formatted as 1,000???)
Can the field have more than 7 digits. If so, how does it get formatted?
Dabas
njvyas007,
Actually there IS a simple solution, which I have just tried:
I created a formula that had the following contents:
totext(1000000,"00,00,000" )
Adding this to the report produced the formatting you wanted.
If you replace the 1000000 with your field, it should produce your desired result!
Dabas
Actually there IS a simple solution, which I have just tried:
I created a formula that had the following contents:
totext(1000000,"00,00,000"
Adding this to the report produced the formatting you wanted.
If you replace the 1000000 with your field, it should produce your desired result!
Dabas
num=format(num,"###,###,## 0.00")
njvyas:
Any luck?
Dabas
Any luck?
Dabas
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
- Accept Dabas comment as answer.
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
I will leave a recommendation in the Cleanup topic area that this question is:
- Accept Dabas comment as answer.
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
For example
Left(inVal, 2) + "," + Mid(inVal, 3, 2) + "," + Right(inVal, 3)
You might have to do some conversion on you values to convert them to strings, since these are string functions. Also, this example assumes a number of the length you mentioned. You may have to do a little manipulating for different lengths.