ms access - INSERT INTO number value with comma thousand delimiter -
my sql is
"insert table1 (item, price) value ('" & itemstring & "', " & pricevalue & ")"
it works fine. but, if price 12,345.67.
sql error message is
number of query values , destination fields not same.
it because value thousand comma delimiter. how should modify sql
let number value has comma delimiter (and possible $ sign)?
thanks in advance.
this must use str convert decimal number us-formatted string expression ignoring local settings:
"insert table1 (item, price) value ('" & itemstring & "', " & str(pricevalue) & ")"
the magic str is always inserts dot decimal separator, nothing more, nothing less. makes bullet-proof , simplest possible solution.
most other methods fail in international environments decimal separator not dot.
Comments
Post a Comment