How to change currency setting (Windows API) using VBA in Access

I have found an article how to change short date of regional settings using VBA in Access.  I would like to do the same with currency.  Can anybody please help me.
Thanks
rlouwAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SteinerCommented:
How do you change your short date in Access (neither do I know that article nor do I have Access)?
I just change the registry key for the short date. The same should work with the currency to (key sCurrency instead of sShortDate).

Greets
Steiner
0
rlouwAuthor Commented:
I use dates in MS Access (97 and 2000)to base calculations on. My uses are lock unto a network and every time they lock on, the server change their date settings.  I have found M Knowledge based article 168793 on how to change their short date settings from VB in Access each time they lock into my Access system.  I want to do the same with currency as they are inexperienced PC users and I do not what to leave it up to them to do the changes manually.
Rykie
0
Richie_SimonettiIT OperationsCommented:
i have a module to manage all regional settings:

Option Explicit
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

Declare Function SetLocaleInfo Lib "kernel32" Alias _
"SetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, _
ByVal lpLCData As String) As Boolean

Declare Function GetUserDefaultLCID% Lib "kernel32" ()

'Enum para envio de valores
'de la configuracion regional.
Public Enum LOCAL_INFO
  ICountry = &H5
  ICurrencyDecDigits = &H19
  IDefaultCodePage = &HB
  IIDEDefCountry = &HA
  IIDEDefLang = &H9
  IDecDigits = &H11
  SyAM = &H28
  SyPM = &H29
  SyShortCtryName = &H7
  SyShortDayName1 = &H31
  SyShortDayName2 = &H32
  SyShortDayName3 = &H33
  SyShortDayName4 = &H34
  SyShortDayName5 = &H35
  SyShortDayName6 = &H36
  SyShortDayName7 = &H37
  SyShortLangName = &H3
  SymShortMonthName1 = &H44
  SyCountry = &H6
  SyShortCurrency = &H14
  SyDateSep = &H1D
  SyLongDayName1 = &H2A
  SyLongDayName2 = &H2B
  SyLongDayName3 = &H2C
  SyLongDayName4 = &H2D
  SyLongDayName5 = &H2E
  SyLongDayName6 = &H2F
  SyLongDayName7 = &H30
  SymCtryNameInEng = &H1002
  SyLangInEnglish = &H1001
  SyNumberDigitsGroup = &H10
  SyInternacLang = &H15
  SKeybDistrib = &H2
  SyListSep = &HC
  SyLongDate = &H20
  SyDecimalSep = &H16
  ICurrencyDigitsGroup = &H18
  SyMonthName1 = &H38
  SyMonthName2 = &H39
  SyMonthName3 = &H3A
  SyMonthName4 = &H3B
  SyMonthName5 = &H3C
  SyMonthName6 = &H3D
  SyMonthName7 = &H3E
  SyMonthName8 = &H3F
  SyMonthName9 = &H40
  SyMonthName10 = &H41
  SyMonthName11 = &H42
  SyMonthName12 = &H43
  SyCurrencyThousandSep = &H17
  SyNativeCtryName = &H8
  SyNativeDigits = &H13
  SyNativeLangName = &H4
  SyNegativeSign = &H51
  SyPositiveSign = &H50
  SyShortDate = &H1F
  SyThousand = &HF
  SyHourSeparator = &H1E
  SyHourFormat = &H1003
End Enum

Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Const HWND_BROADCAST = &HFFFF&
Public Const WM_WININICHANGE = &H1A

Public Function Get_locale(RSValue As LOCAL_INFO) ' Retrieve the regional setting

      Dim Symbol As String
      Dim iRet1 As Long
      Dim iRet2 As Long
      Dim lpLCDataVar As String
      Dim Pos As Integer
      Dim Locale As Long
     
      Locale = GetUserDefaultLCID()

      iRet1 = GetLocaleInfo(Locale, RSValue, _
      lpLCDataVar, 0)
      Symbol = String$(iRet1, 0)
     
      iRet2 = GetLocaleInfo(Locale, RSValue, Symbol, iRet1)
      Pos = InStr(Symbol, Chr$(0))
      If Pos > 0 Then
           Symbol = Left$(Symbol, Pos - 1)
           Get_locale = Symbol
      End If

End Function

Public Function Set_locale(RSValue As LOCAL_INFO, Symbol As String) 'Change the regional setting
      Dim iRet As Long
      Dim Locale As Long

      Locale = GetUserDefaultLCID() 'Get user Locale ID
      iRet = SetLocaleInfo(Locale, RSValue, Symbol)
     
End Function
Public Sub Anounce_locale_change()
PostMessage HWND_BROADCAST, WM_WININICHANGE, 0, 0
End Sub


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rlouwAuthor Commented:
Thank you.  I have tried it and I am very happy with the results.

Rykie Louw
0
Richie_SimonettiIT OperationsCommented:
Glad to help. Thanks for "A" grade!
Cheers
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.