
Regional Settings problem with Val(), Format$(), etc...
Use the specific
Visual Basic data type conversion functions. For example,
from the Microsoft documentation:
You should use the CCur to provide internationally aware conversions from
any other data type to a Currency subtype. For example, different decimal
separators and thousands separators are properly recognized depending on the
locale setting of your system.
Use the CDbl to provide internationally aware conversions from any other
data type to a Double subtype. For example, different decimal separators and
thousands separators are properly recognized depending on the locale setting
of your system.
Etc.
In general, SQL expects US formats e.g. dates.
Peter
Quote:
> I've got this problem for so long that I've decided to share it and maybe
> i'll get a easy solution to it.
> My regional settings, when it comes to 'Number' are
> Decimal symbol: , (comma)
> Digit Grouping symbol: . (dot)
> These settings doesn't comply with Val(), Format() and other functions,
and
> SQL.
> Many times, I get a 'Overflow error' because a number like
> 120.000,00 is interpreted as 12000000 when calculations are being made or
> something else simpler as an assignement,
> or this numeric values are passed to and SQL statement, it takes that the
> comma "," as a parameter separator and I get an error like
> 'Different number of fields..." or something like that...
> Does anyone had this problem before? How can I solve this?