A
arista via AccessMonster.com
Hi, I have used some code that is recommended here to get a regional setting.
Unfortunatelly it doesn't work properly. It always finds "United Kingdom"
even I change the settings to be different country!
I need this just to display a message when the regional setting is different
from the united kingdom.
Can anybody help pls?
Here is a code which I use:
'const for regional settings
Public Const LOCALE_SENGCOUNTRY As Long = &H1002 'English name of country
Public Declare Function GetSystemDefaultLCID Lib "kernel32" () As Long
Public 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 Function GetUserLocaleInfo(ByVal dwLocaleID As Long, ByVal dwLCType As
Long) As String
Dim sReturn As String
Dim r As Long
'call the function passing the Locale type
'variable to retrieve the required size of
'the string buffer needed
r = GetLocaleInfo(dwLocaleID, dwLCType, sReturn, Len(sReturn))
'if successful..
If r Then
'pad the buffer with spaces
sReturn = Space$(r)
'and call again passing the buffer
r = GetLocaleInfo(dwLocaleID, dwLCType, sReturn, Len(sReturn))
'if successful (r > 0)
If r Then
'r holds the size of the string
'including the terminating null
GetUserLocaleInfo = Left$(sReturn, r - 1)
End If
End If
End Function
Private Sub Form_Load()
Dim LCID As Long
Dim xRegionalSet As String
LCID = GetSystemDefaultLCID()
'LOCALE_SENGCOUNTRY Full English name of the country/region. This is
always restricted to characters that can be mapped into the ASCII 127-
character subset.
xRegionalSet = GetUserLocaleInfo(LCID, LOCALE_SENGCOUNTRY)
If (xRegionalSet = "United Kingdom") Then
'nothing
Else
MsgBox "Regional setting isn't set as United Kingdom. It is strongly
adviced to set the regional settings as United Kingdom when using database.
Otherwise some features will not work correctly ! Go to the System ->
Settings -> Regional Settings in your computer system and change the regional
settings country to be United Kingdom.", vbOKOnly, "Regional Setting Problem"
End If
End Sub
Unfortunatelly it doesn't work properly. It always finds "United Kingdom"
even I change the settings to be different country!
I need this just to display a message when the regional setting is different
from the united kingdom.
Can anybody help pls?
Here is a code which I use:
'const for regional settings
Public Const LOCALE_SENGCOUNTRY As Long = &H1002 'English name of country
Public Declare Function GetSystemDefaultLCID Lib "kernel32" () As Long
Public 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 Function GetUserLocaleInfo(ByVal dwLocaleID As Long, ByVal dwLCType As
Long) As String
Dim sReturn As String
Dim r As Long
'call the function passing the Locale type
'variable to retrieve the required size of
'the string buffer needed
r = GetLocaleInfo(dwLocaleID, dwLCType, sReturn, Len(sReturn))
'if successful..
If r Then
'pad the buffer with spaces
sReturn = Space$(r)
'and call again passing the buffer
r = GetLocaleInfo(dwLocaleID, dwLCType, sReturn, Len(sReturn))
'if successful (r > 0)
If r Then
'r holds the size of the string
'including the terminating null
GetUserLocaleInfo = Left$(sReturn, r - 1)
End If
End If
End Function
Private Sub Form_Load()
Dim LCID As Long
Dim xRegionalSet As String
LCID = GetSystemDefaultLCID()
'LOCALE_SENGCOUNTRY Full English name of the country/region. This is
always restricted to characters that can be mapped into the ASCII 127-
character subset.
xRegionalSet = GetUserLocaleInfo(LCID, LOCALE_SENGCOUNTRY)
If (xRegionalSet = "United Kingdom") Then
'nothing
Else
MsgBox "Regional setting isn't set as United Kingdom. It is strongly
adviced to set the regional settings as United Kingdom when using database.
Otherwise some features will not work correctly ! Go to the System ->
Settings -> Regional Settings in your computer system and change the regional
settings country to be United Kingdom.", vbOKOnly, "Regional Setting Problem"
End If
End Sub