converting string to double

Nirious

Registered User.
Local time
Today, 23:00
Joined
Jul 31, 2004
Messages
106
Hi,

Can anyone tell me again what that function was that converts a string to a double? Someone told me once before so I know it exists but I forgot :(

The function recognized point and comma both as decimal point.
So e.g. It would convert
5.69 or 5,69 to the appropriate decimal sign that access uses for a double.
 
Nope,

that wasn't the one.
That one turns 12.50 into 1250 on my pc :cool:

There was a way that you could convert it using a function that accepted both point and comma as the decimal sign.
 
Whee

After some messing around I found it again on my own :)

To make your program able to read numbers with a different decimal point than your own, put this function in a module and call it instead of CDbl().


CODE:
Public Function CDblExt(ByVal s As String) As Double

Dim t As Double
t = CDbl(Val(Replace(s, ",", ".")))
CDblExt = t

End Function


As a result,
Both 3.50 and 3,50 will become 3.50 is you use a point in the regional settings or 3,50 if you use a comma in the regional settings. :)
 

Users who are viewing this thread

Back
Top Bottom