Regional Settings problem with Val(), Format$(), etc... 
Author Message
 Regional Settings problem with Val(), Format$(), etc...

Hi,

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?

Thanks in advance...



Sun, 14 Apr 2002 03:00:00 GMT  
 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?



Sun, 14 Apr 2002 03:00:00 GMT  
 Regional Settings problem with Val(), Format$(), etc...
Which should have said.

In general, SQL expects ISO or, for Microsoft, US format dates.

Peter


Quote:
> In general, SQL expects US formats e.g. dates.

> Peter



Sun, 14 Apr 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Date format and regional settings

2. Number format and regional settings

3. Date format vbLongDate ignores server's regional settings

4. VBScript Date format- regional settings ?

5. reliable date formatting unrelated to regional settings

6. Formatting integers using regional settings

7. How Can I Change the Short Date Format At Regional Settings in Control Panel

8. How to get the Regional Setting of ShortDate format

9. VB, Chart Object, Databases and problems with regional settings

10. problem with regional settings

11. problem with VBSCRIPT and regional settings

12. Regional Settings Problems

 

 
Powered by phpBB® Forum Software