473,498 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem reading Digit Grouping Symbol

I tried to retrieve the digit grouping symbol in MSAccess but
unfortunately 3;0 is retrieved instead of comma which is my symbol.
Function retrieves decimal symbol and list separator without any
problem.

I used the code below:

var_char_copied = GetLocaleInfo(LOCALE_USER_DEFAULT,
LOCALE_SGROUPING, var_SYSTEM_DTG, Len(var_SYSTEM_DTG))

If var_char_copied 0 Then
var_SYSTEM_DTG = Trim(Mid(var_SYSTEM_DTG, 1, var_char_copied))
End If

Declare Function GetLocaleInfo Lib "kernel32" Alias
"GetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, ByVal
lpLCData As String, ByVal cchData As Long) As Long

Public Const LOCALE_SDECIMAL = &HE ' decimal separator
Public Const LOCALE_SLIST = &HC ' list item separator
Public Const LOCALE_SGROUPING = &H10 ' digit grouping
Public Const LOCALE_USER_DEFAULT As Long = 0

Thanks a lot in advance!
Nov 27 '07 #1
4 3841
>I tried to retrieve the digit grouping symbol in MSAccess but
unfortunately 3;0 is retrieved instead of comma which is my symbol.
Function retrieves decimal symbol and list separator without any
problem.
Here are non-API routines I use to retrieve the various regional setting
symbols and formats (use them exactly as posted, don't try to adjust them in
any way, they are correct as posted)... does the one I use for Thousands
Separator work for you?

DateSeparator = Format$(0, "/")

DecimalPoint = Format$(0, ".")

ThousandsSeparator = Mid$(Format$(1000, "#,###"), 2, 1)

Function DateFormat() As String
DateFormat = CStr(DateSerial(2003, 1, 2))
DateFormat = Replace(DateFormat, "2003", "YYYY")
DateFormat = Replace(DateFormat, "03", "YY")
DateFormat = Replace(DateFormat, "01", "MM")
DateFormat = Replace(DateFormat, "1", "M")
DateFormat = Replace(DateFormat, "02", "dd")
DateFormat = Replace(DateFormat, "2", "d")
DateFormat = Replace(DateFormat, MonthName(1), "MMMM")
DateFormat = Replace(DateFormat, MonthName(1, True), "MMM")
End Function

Function TimeFormat() As String
TimeFormat = CStr(TimeSerial(13, 22, 44))
TimeFormat = Replace(TimeFormat, "22", "mm")
TimeFormat = Replace(TimeFormat, "44", "ss")
If InStr(TimeFormat, "13") 0 Then
TimeFormat = Replace(TimeFormat, "13", "HH")
If InStr(CStr(TimeSerial(1, 22, 44)), "0") = 0 Then
TimeFormat = Replace(TimeFormat, "HH", "H")
End If
Else
TimeFormat = Replace(TimeFormat, "1", "h")
TimeFormat = Replace(TimeFormat, "0", "h")
TimeFormat = Replace(TimeFormat, "PM", "tt", , , vbTextCompare)
End If
End Function
Rick

Nov 27 '07 #2
Chris wrote:
I tried to retrieve the digit grouping symbol in MSAccess but
unfortunately 3;0 is retrieved instead of comma which is my symbol.
Function retrieves decimal symbol and list separator without any
problem.

I used the code below:

var_char_copied = GetLocaleInfo(LOCALE_USER_DEFAULT,
LOCALE_SGROUPING, var_SYSTEM_DTG, Len(var_SYSTEM_DTG))

If var_char_copied 0 Then
var_SYSTEM_DTG = Trim(Mid(var_SYSTEM_DTG, 1, var_char_copied))
End If

Declare Function GetLocaleInfo Lib "kernel32" Alias
"GetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, ByVal
lpLCData As String, ByVal cchData As Long) As Long

Public Const LOCALE_SDECIMAL = &HE ' decimal separator
Public Const LOCALE_SLIST = &HC ' list item separator
Public Const LOCALE_SGROUPING = &H10 ' digit grouping
Public Const LOCALE_USER_DEFAULT As Long = 0

Thanks a lot in advance!
Well, one thing I see wrong is the LOCALE_USER_DEFAULT value (should be &h800).
Another is that you're asking for a list separator, not the digit grouping symbol,
but perhaps that's on purpose and you snipped the wrong code? You don't give enough
information to tell whether the other parameters are correct, or not. (For
instance, are you preallocating a big enough buffer?)

Try this -- http://vb.mvps.org/samples/Locale -- and let me know if it's getting the
wrong value on your system as well.

Thanks... Karl
--
..NET: It's About Trust!
http://vfred.mvps.org
Nov 27 '07 #3

Thanks Karl for your message.

Parameter LOCALE_USER_DEFAULT or &h800 passed for Locale, return the
same results for decimal, list and grouping symbol. The first 2 are
correct, the grouping symbol is wrong.

With the LOCALE_SGROUPING parameter value I want to retrieve the digit
grouping symbol. The string variable I use for retrieving the value
includes 255 spaces as below:

var_SYSTEM_DTG = Space(255)

var_char_copied = GetLocaleInfo(LOCALE_USER_DEFAULT,
LOCALE_SGROUPING, var_SYSTEM_DTG, Len(var_SYSTEM_DTG))

If var_char_copied 0 Then
var_SYSTEM_DTG = Trim(Mid(var_SYSTEM_DTG, 1, var_char_copied))
End If
Nov 28 '07 #4

Thanks a lot Rick for your message. The thousands separator works in
my case.
Nov 28 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

68
4285
by: Marco Bubke | last post by:
Hi I have read some mail on the dev mailing list about PEP 318 and find the new Syntax really ugly. def foo(x, y): pass I call this foo(1, 2), this isn't really intuitive to me! Also I...
6
3435
by: Henry Jordon | last post by:
This is a piece of code that I have left to complete my project. I have hopefully one small error that needs to be fixed. This portion of the code evaluates the postfix notation that is passed to...
2
22743
by: hvaisane | last post by:
Valgrind says ==11604== Invalid read of size 4 ==11604== at 0x8048ABB: main (foo.cc:36) ==11604== Address 0x1B92415C is 4 bytes inside a block of size 8 free'd ==11604== at 0x1B90514F:...
1
2591
by: BigMan | last post by:
Is it possible to specify digit grouping when writing to an output stream (so that std::cout << 1234.56789; produces "1 234.567 89", for example)? If so, how?
1
2403
by: Luis Lanuza | last post by:
Hi all, I can't get Visual Studio 2003 to recognize my WindowsXP SP2 regional settings. For ex: On Control Panel / Regional Settings / Regional Options Tab, my standadrs and formats corresponds...
6
3510
by: efrenba | last post by:
Hi, I came from delphi world and now I'm doing my first steps in C++. I'm using C++builder because its ide is like delphi although I'm trying to avoid the vcl. I need to insert new features...
0
1521
by: Roman Bertle | last post by:
Hello, I try to format monetary values using the locale module, python2.5: Python 2.5.2a0 (r251:54863, Jan 3 2008, 17:59:56) on linux2 Type "help", "copyright", "credits" or "license" for...
1
1105
by: brad | last post by:
Victor Bazarov wrote: Wow. That works. I do not fully understand why it works, but I wanted to thank you for the advice. I'll research it more until I better understand. Brad
5
5303
by: John Ztwin | last post by:
Hello, I have a file that contains ordinary text and some special charaters in Unicode escape sequences (\uxxxx). When I read the file using e.g. StreamReader Unicode escape sequences are not...
0
7125
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7004
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6890
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7379
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5464
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4915
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3095
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
657
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
292
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.