Decimal symbol confusion

hbrems

has no clue...
Local time
Today, 15:51
Joined
Nov 2, 2006
Messages
181
Dear all,

a double value is stored as 0,75 in my database (comma as per the regional settings).

In visual basic when I try to retrieve this value with a dlookup function I get the same result: 0,75 (comma as decimal symbol). Here's the dlookup function:

Code:
dim dWeight as double
dWeight = dlookup ("fldweight", "tblcustomers", "fldcustomerid = 1")

Suppose I would like to this value into another record I my SQL statement will look something like this:

Code:
INSERT INTO tblorders (fldcustomerid, fldweight) VALUES ("SomeCustomer", 0,75)

This will return an error as SQL uses the comma as a seperator and expects a decimal point as decimal symbol.

So my question is. How can I convert a double 0,75 to a double 0.75 in visual basic.

Kind regards,
Hans B.
 
Replace([YourFieldName], ",",".")

Hi Bob,

your solution works IF if change the dWeight variable, currently a double, to a string.

If I don't change the data type the dWeight will contain a value of 75.

Kind regards,
Hans B.
 
convert to a string, replace comma with full stop and convert back to floating point.
 

Users who are viewing this thread

Back
Top Bottom