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

I have dificulties with format of n

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have dificulties with format of number in American English Ex: 64,924,332.99

And brazilian format Ex: 64.924.332,99



Do you have an easy way to transform english numbers to brazilian numbers?

Thank you in advance

 
look up decimal seperator in help. International settings for numbers and dates are accomodated in Me. Access.

MichaelRed
mred@att.net

There is never time to do it right but there is always time to do it over
 
aqui está como eu uso:

Function numFmtUsToNum(arg)
Dim x, a, tmp
arg = stripchar(arg, ",")
For x = 1 To Len(arg)
a = Mid(arg, x, 1): If a = "," Then a = "."
tmp = tmp & a
Next
If IsNumeric(tmp) Then numFmtUsToNum = Val(tmp) Else numFmtUsToNum =
Null
End Function
Function stripchar(arg, ch)
Dim x, tmp, a
For x = 1 To Len(arg)
a = Mid(arg, x, 1)
If a <> ch Then tmp = tmp & a
Next
stripchar = tmp
End Function

'? numFmtUsToNum(&quot;200,000,000.11&quot;)
' 200000000,11
 
Hmmmmmmmmmm, want to SEE the CODE?

For the First example:

Code:
Public Function basUs2Brazil(ValIn As String) As String

    '? basUs2Brazil(&quot;64,924,332.99&quot;)
    '64.924.332,99

    Dim MyStr(1) As String

    MyStr(0) = Replace(ValIn, &quot;,&quot;, &quot;!&quot;)
    MyStr(1) = Replace(MyStr(0), &quot;.&quot;, &quot;,&quot;)
    MyStr(0) = Replace(MyStr(1), &quot;!&quot;, &quot;.&quot;)

    basUs2Brazil = MyStr(0)

End Function

The second (leaves out the Original Commas instead or replacing with dots:

Code:
Public Function basUs2BrazilII(ValIn As String) As String

    '? basUs2BrazilII(&quot;200,000,000.11&quot;)
    ' 200000000,11

    Dim MyStr(1) As String

    MyStr(0) = Replace(ValIn, &quot;,&quot;, &quot;&quot;)
    MyStr(1) = Replace(MyStr(0), &quot;.&quot;, &quot;,&quot;)

    basUs2BrazilII = MyStr(1)
    
End Function
MichaelRed
mred@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top