Questa piccola funzione permette di cambiare il formato di un numero passato come parametro, inserendo il separatore delle migliaia e due cifre decimale dopo la virgola.
Function FormatItNumner(ByVal Amount)
Dim myInt, myDec, myNewInt, i, lenInt, myStr, myPos
if not isnull(Amount) then
Amount = CStr(Amount)
if Amount <> "0" and Amount <>"" then
myInt = Left(Amount, Len(Amount) - 2)
myDec = Right(Amount, 2)
lenInt = Len(myInt)
i = 0
myPos = lenInt
Do Until i = lenInt
If (i Mod 3) = 0 Then
If i < 3 Then
myStr = Mid(myInt, myPos, 1) & myStr
Else
myStr = Mid(myInt, myPos, 1) & "." & myStr
End If
Else
myStr = Mid(myInt, myPos, 1) & myStr
End If
myPos = myPos - 1
i = i + 1
Loop
end if
end if
if myDec <> "" then
FormatItNumner = myStr & "," & myDec
else
FormatItNumner = myStr
end if
End Function