none
Change Regional Settings In Access RRS feed

  • Question

  • I need to change regional settings within Access (versions 2010, 2013, 2016) and have tried using the following code

    Public Const HWND_BROADCAST = &HFFFF&
    Public Const WM_SETTINGCHANGE = &H1A
    Public Const LOCALE_SCURRENCY = &H14

    Public Declare Function SetLocaleInfo Lib "kernel32" Alias "SetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String) As Boolean
    Public Declare Function GetUserDefaultLCID Lib "kernel32" () As Long
    Public Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

    Public Sub SetCurrencyFormat(format As String)
        Dim lngIdentifier As Long
        lngIdentifier = GetUserDefaultLCID()
        If SetLocaleInfo(lngIdentifier, LOCALE_SCURRENCY, format) = False Then
            MsgBox "Error occured while trying to change the setting."
        End If
    End Sub

    Call SetCurrencyFormat("$")

    'send a system notification
    Call PostMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0&, ByVal 0&)

    The code does change the settings on the machine but to get Access to use the new settings, Access has to be closed and re-opened.

    Is there any way to get Access to recognise the new Regional Settings without closing and reopening?

    Any help would be most appreciated.

    Thank you.

    Friday, July 14, 2017 8:57 AM

All replies

  • Hi,

    Your problem is related Access Develop problem, I'll move your question to the MSDN forum for Access Developer forum:

    https://social.msdn.microsoft.com/Forums/en-US/home?forum=accessdev

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.


    Regards,
    Emi Zhang
    TechNet Community Support

    Please remember to mark the replies as answers if they helped.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Monday, July 17, 2017 2:29 AM
  • It appears those settings are cached at startup time. There certainly is no documented way to do what you want. Go ahead and bite the bullet of a restart.

    Or handle everything inside of Access, regardless of regional settings.


    -Tom. Microsoft Access MVP

    Monday, July 17, 2017 2:57 AM