hi all....i have a string which accepts money...in any form like...123456 or 1,23,456.00 or 3456.00...... finally i want it to be coverted to...1,23,456.00, 3,456.00 (comma after lakhs,thousands....with a double digit precision)....please tell me if there is any fucntion or a code to accomplish this ASAP....
9 2331
you need to use the FORMAT function for the purpose.
hey thks for reply...i know format function helps in tht case..but its returning the value as....123,456.00..if the input is more than 1lakh......also i used formatnumber...enen then the result is same....i want it to return...as...1,23,456.00.......reply me ASAP....thks for any kind of help...
you need to use the FORMAT function for the purpose.
try like this
Format(12345678.00004, "###,###,###.#####") AND DO NOT START A DUPLICATE THREAD FOR THE SAME QUESTION
Hi,
I Guess, using any Combination of Locale setting and Format, you would end up with a Digit grouping of 3 Digits..
You can write a Format function of your own..
Try this : -
Private Function MyFormat(ByVal TNum As String) As String
-
'
-
Dim TStr As String
-
Dim OStr As String
-
Dim TempStr As String
-
'
-
TNum = Replace(TNum, ",", "")
-
'
-
OStr = Format(TNum, "0.00")
-
TStr = Right(OStr, 6)
-
If Len(OStr) <= 6 Then
-
MyFormat = TStr
-
Else
-
OStr = Left(OStr, Len(OStr) - 6)
-
Do
-
TempStr = Right(OStr, 2)
-
TStr = TempStr & "," & TStr
-
OStr = Left(OStr, Len(OStr) - Len(TempStr))
-
Loop Until Trim(OStr) = ""
-
MyFormat = TStr
-
End If
-
'
-
End Function
-
To Call this Function, use this code: -
Private Sub Text1_LostFocus()
-
Text1.Text = MyFormat(Text1)
-
End Sub
-
Regards
Veena
thks for the reply..but the result it generates is....12,345,678.00004......wich is not i wanted....plz it should seperate lakhs with a comma...thousands with a comma...and so on.....the output should be like....1,23,45,678.00......plz help me out....
try like this
Format(12345678.00004, "###,###,###.#####") AND DO NOT START A DUPLICATE THREAD FOR THE SAME QUESTION
cant you change the position of comma ?
Code from QVeen works fine but after modifying for a negative number.
Hi!
Here is the Code you are looking for. Please Find the attachment here with this post.
With Regards
Vijay. R
infact..i shud say thks to veena(QVeen72 )....tht code worked well...thks a lot..for ur help..
Hi,
I Guess, using any Combination of Locale setting and Format, you would end up with a Digit grouping of 3 Digits..
You can write a Format function of your own..
Try this : -
Private Function MyFormat(ByVal TNum As String) As String
-
'
-
Dim TStr As String
-
Dim OStr As String
-
Dim TempStr As String
-
'
-
TNum = Replace(TNum, ",", "")
-
'
-
OStr = Format(TNum, "0.00")
-
TStr = Right(OStr, 6)
-
If Len(OStr) <= 6 Then
-
MyFormat = TStr
-
Else
-
OStr = Left(OStr, Len(OStr) - 6)
-
Do
-
TempStr = Right(OStr, 2)
-
TStr = TempStr & "," & TStr
-
OStr = Left(OStr, Len(OStr) - Len(TempStr))
-
Loop Until Trim(OStr) = ""
-
MyFormat = TStr
-
End If
-
'
-
End Function
-
To Call this Function, use this code: -
Private Sub Text1_LostFocus()
-
Text1.Text = MyFormat(Text1)
-
End Sub
-
Regards
Veena
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Batista, Facundo |
last post by:
Here I send it.
Suggestions and all kinds of recomendations are more than welcomed.
If it all goes ok, it'll be a PEP when I finish writing the code.
Thank you.
.. Facundo
|
by: Bill |
last post by:
I'm getting the following error:
Disallowed implicit
conversion from data type varchar to data type money, table
'bill.dbo.cart', column 'price'. Use the CONVERT function to run this
query.
...
|
by: shank |
last post by:
I'm getting the following error...
Microsoft OLE DB Provider for SQL Server error '80040e07'
Disallowed implicit conversion from data type varchar to data type money,
table 'wsOrders', column...
|
by: teddysnips |
last post by:
In the script below is the DDL to create some tables and a UDF.
What I'm interested in is the UDF at the end. Specifically, these few
lines:
--CLOSE OTRate
--DEALLOCATE OTRate
ELSE --...
|
by: mike |
last post by:
If I have a document like:
<script>
function mike_test()
{alert('hi');}
</script>
<iframe src="blank.html" id="my_iframe1">
</iframe>
and in blank.html I have:
|
by: mpurnachary |
last post by:
Hi...
Plz... Help me...
I want some code for Converting a Number (money) to Words in Indian Format in C#.NET
eg.: if I enter 12345678 then it gives as ...
" ONE CRORE TWENTY...
|
by: SQACPP |
last post by:
Hi,
I try to figure out how to use Callback procedure in a C++ form
project
The following code *work* perfectly on a console project
#include "Windows.h"
BOOL CALLBACK...
|
by: souporpower |
last post by:
Hello All
I am trying to activate a link using Jquery. Here is my code;
<html>
<head>
<script type="text/javascript" src="../../resources/js/
jquery-1.2.6.js"</script>
<script...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |