在Access中更改区域设置 [英] Change Regional Settings In Access

查看:138
本文介绍了在Access中更改区域设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在Access(版本2010,2013,2016)中更改区域设置并尝试使用以下代码

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 Const HWND_BROADCAST = &HFFFF&
Public Const WM_SETTINGCHANGE = &H1A
Public Const LOCALE_SCURRENCY = &H14

Public Declare Function SetLocaleInfo Lib" kernel32"别名"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"别名"PostMessageA" (ByVal hwnd As Long,ByVal wMsg As Long,ByVal wParam As Long,lParam as Any)As long

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()

   如果SetLocaleInfo(lngIdentifier,LOCALE_SCURRENCY,格式)= False则为
        MsgBox"尝试更改设置时出错。"
$
   结束如果

结束子

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

调用SetCurrencyFormat(" $")

Call SetCurrencyFormat("$")

'发送系统通知

调用PostMessage(HWND_BROADCAST,WM_SETTINGCHANGE,0&,ByVal 0&)

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

代码确实会更改计算机上的设置,但要让Access使用新设置,必须关闭并重新打开Access。

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.

有没有办法获取Access在没有关闭和重新开启的情况下识别新的区域设置?

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

任何帮助都将非常受欢迎。

Any help would be most appreciated.

谢谢。

推荐答案

你的问题是相关的Access Develop问题,我将您的问题转移到Access Developer论坛的MSDN论坛:

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

我们建议适当发布的原因是y您将获得最合格的受访者群体,定期阅读论坛的其他合作伙伴可以分享他们的知识或从您与我们的互动中学习。感谢您的理解。

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.


这篇关于在Access中更改区域设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆