Bosna i Hercegovina



#1 08.05.2013-09:48
Amelasar Offline
Clan
Registrovan/a od: 07.04.2011-18:28
Komentari: 234


Subject: Regionalne postavke direktno iz access-a?
Da li je moguce iz access-a podesavati regionalne postavke, znaci format datuma, vremena, decimal simbol i ostalo?
Pozdrav, Amela
↑  ↓

#2 08.05.2013-10:57
Amelasar Offline
Clan
Registrovan/a od: 07.04.2011-18:28
Komentari: 234


Subject: Re: Regionalne postavke direktno iz access-a?
Rjesenje:

DownloadIzvorni kod (Text):
  1. Option Compare Database
  2.  
  3. 'These declarations are designed
  4. 'for use in a .bas module
  5. 'since the constants are public
  6.  
  7.  
  8. Declare Function GetLocaleInfo Lib "kernel32" Alias _
  9. "GetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, _
  10. ByVal lpLCData As String, ByVal cchData As Long) As Long
  11.  
  12. Public Declare Function GetSystemDefaultLCID Lib "kernel32" () As Long
  13.  
  14. Public Declare Function PostMessage Lib "user32" _
  15.    Alias "PostMessageA" _
  16.   (ByVal hwnd As Long, _
  17.    ByVal wMsg As Long, _
  18.    ByVal wParam As Long, _
  19.    lParam As Any) As Long
  20.  
  21. Declare Function SetLocaleInfo Lib "kernel32" Alias _
  22. "SetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, _
  23. ByVal lpLCData As String) As Boolean
  24.  
  25. Declare Function GetUserDefaultLCID% Lib "kernel32" ()
  26.  
  27. Public Const LOCALE_ICENTURY = &H24
  28. Public Const LOCALE_ICOUNTRY = &H5
  29. Public Const LOCALE_ICURRDIGITS = &H19
  30. Public Const LOCALE_ICURRENCY = &H1B
  31. Public Const LOCALE_IDATE = &H21
  32. Public Const LOCALE_IDAYLZERO = &H26
  33. Public Const LOCALE_IDEFAULTCODEPAGE = &HB
  34. Public Const LOCALE_IDEFAULTCOUNTRY = &HA
  35. Public Const LOCALE_IDEFAULTLANGUAGE = &H9
  36. Public Const LOCALE_IDIGITS = &H11
  37. Public Const LOCALE_IINTLCURRDIGITS = &H1A
  38. Public Const LOCALE_ILANGUAGE = &H1
  39. Public Const LOCALE_ILDATE = &H22
  40. Public Const LOCALE_ILZERO = &H12
  41. Public Const LOCALE_IMEASURE = &HD
  42. Public Const LOCALE_IMONLZERO = &H27
  43. Public Const LOCALE_INEGCURR = &H1C
  44. Public Const LOCALE_INEGSEPBYSPACE = &H57
  45. Public Const LOCALE_INEGSIGNPOSN = &H53
  46. Public Const LOCALE_INEGSYMPRECEDES = &H56
  47. Public Const LOCALE_IPOSSEPBYSPACE = &H55
  48. Public Const LOCALE_IPOSSIGNPOSN = &H52
  49. Public Const LOCALE_IPOSSYMPRECEDES = &H54
  50. Public Const LOCALE_ITIME = &H23
  51. Public Const LOCALE_ITLZERO = &H25
  52. Public Const LOCALE_NOUSEROVERRIDE = &H80000000
  53. Public Const LOCALE_S1159 = &H28
  54. Public Const LOCALE_S2359 = &H29
  55. Public Const LOCALE_SABBREVCTRYNAME = &H7
  56. Public Const LOCALE_SABBREVDAYNAME1 = &H31
  57. Public Const LOCALE_SABBREVDAYNAME2 = &H32
  58. Public Const LOCALE_SABBREVDAYNAME3 = &H33
  59. Public Const LOCALE_SABBREVDAYNAME4 = &H34
  60. Public Const LOCALE_SABBREVDAYNAME5 = &H35
  61. Public Const LOCALE_SABBREVDAYNAME6 = &H36
  62. Public Const LOCALE_SABBREVDAYNAME7 = &H37
  63. Public Const LOCALE_SABBREVLANGNAME = &H3
  64. Public Const LOCALE_SABBREVMONTHNAME1 = &H44
  65. Public Const LOCALE_SCOUNTRY = &H6
  66. Public Const LOCALE_SCURRENCY = &H14
  67. Public Const LOCALE_SDATE = &H1D
  68. Public Const LOCALE_SDAYNAME1 = &H2A
  69. Public Const LOCALE_SDAYNAME2 = &H2B
  70. Public Const LOCALE_SDAYNAME3 = &H2C
  71. Public Const LOCALE_SDAYNAME4 = &H2D
  72. Public Const LOCALE_SDAYNAME5 = &H2E
  73. Public Const LOCALE_SDAYNAME6 = &H2F
  74. Public Const LOCALE_SDAYNAME7 = &H30
  75. Public Const LOCALE_SDECIMAL = &HE
  76. Public Const LOCALE_SENGCOUNTRY = &H1002
  77. Public Const LOCALE_SENGLANGUAGE = &H1001
  78. Public Const LOCALE_SGROUPING = &H10
  79. Public Const LOCALE_SINTLSYMBOL = &H15
  80. Public Const LOCALE_SLANGUAGE = &H2
  81. Public Const LOCALE_SLIST = &HC
  82. Public Const LOCALE_SLONGDATE = &H20
  83. Public Const LOCALE_SMONDECIMALSEP = &H16
  84. Public Const LOCALE_SMONGROUPING = &H18
  85. Public Const LOCALE_SMONTHNAME1 = &H38
  86. Public Const LOCALE_SMONTHNAME10 = &H41
  87. Public Const LOCALE_SMONTHNAME11 = &H42
  88. Public Const LOCALE_SMONTHNAME12 = &H43
  89. Public Const LOCALE_SMONTHNAME2 = &H39
  90. Public Const LOCALE_SMONTHNAME3 = &H3A
  91. Public Const LOCALE_SMONTHNAME4 = &H3B
  92. Public Const LOCALE_SMONTHNAME5 = &H3C
  93. Public Const LOCALE_SMONTHNAME6 = &H3D
  94. Public Const LOCALE_SMONTHNAME7 = &H3E
  95. Public Const LOCALE_SMONTHNAME8 = &H3F
  96. Public Const LOCALE_SMONTHNAME9 = &H40
  97. Public Const LOCALE_SMONTHOUSANDSEP = &H17
  98. Public Const LOCALE_SNATIVECTRYNAME = &H8
  99. Public Const LOCALE_SNATIVEDIGITS = &H13
  100. Public Const LOCALE_SNATIVELANGNAME = &H4
  101. Public Const LOCALE_SNEGATIVESIGN = &H51
  102. Public Const LOCALE_SPOSITIVESIGN = &H50
  103. Public Const LOCALE_SSHORTDATE = &H1F
  104. Public Const LOCALE_STHOUSAND = &HF
  105. Public Const LOCALE_STIME = &H1E
  106. Public Const LOCALE_STIMEFORMAT = &H1003

DownloadIzvorni kod (Text):
  1. Private Sub Command1_Click()
  2.    Dim LCID As Long
  3.    Dim sNewFormat As String
  4.    
  5.    LCID = GetSystemDefaultLCID()
  6.    
  7.    'European #1
  8.    'FormatSymb = "€"
  9.    'FormatDec = ","
  10.    'FormatThou = "."
  11.    'FormatSDate = "d.MM.yy"
  12.    'FormatLDate = "d MMMM yyyy"
  13.    
  14.    'European #2
  15.    FormatSymb = "KM"
  16.    FormatDec = "."
  17.    FormatThou = ","
  18.    FormatSDate = "dd.MM.yy"
  19.    FormatLDate = "dd.MMMM.yyyy"
  20.    
  21.      'set the new long date format
  22.       Call SetLocaleInfo(LCID, LOCALE_SCURRENCY, FormatSymb)
  23.       Call SetLocaleInfo(LCID, LOCALE_SMONDECIMALSEP, FormatDec)
  24.       Call SetLocaleInfo(LCID, LOCALE_SMONTHOUSANDSEP, FormatThou)
  25.       Call SetLocaleInfo(LCID, LOCALE_SLONGDATE, FormatLDate)
  26.       Call SetLocaleInfo(LCID, LOCALE_SSHORTDATE, FormatSDate)
  27.      
  28.      'send a system notification
  29.       Call PostMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0&, ByVal 0&)
  30.      
  31.       Debug.Print format$(10000.56, "Currency")
  32.       Debug.Print format$(Date, "Short Date")
  33.       Debug.Print format$(Date, "Long Date")
  34. End Sub

Jedino tu nema za podesavanje zareza i tacke?
Pozdrav, Amela
↑  ↓

#3 08.05.2013-11:10
Amelasar Offline
Clan
Registrovan/a od: 07.04.2011-18:28
Komentari: 234


Subject: Re: Regionalne postavke direktno iz access-a?
DownloadIzvorni kod (Text):
  1. Call SetLocaleInfo(LCID, LOCALE_SDECIMAL, Dec)
  2. Call SetLocaleInfo(LCID, LOCALE_STHOUSAND, Gru)


Mozda da prebacimo u temu "Koristan VBA kod"?
Pozdrav, Amela
↑  ↓

#4 08.05.2013-11:30
zxz Offline
Administrator
Registrovan/a od: 03.02.2009-16:22
Komentari: 9,692


Subject: Re: Regionalne postavke direktno iz access-a?
Moze prebaci i malo opisi.
Ja sam evo pripremio bio i proceduru.
Function SetReg()
Dim a, b, c, d, Korisnik
Korisnik = GetUserDefaultLCID()
b = SetLocaleInfo(Korisnik, LOCALE_SCURRENCY, "kn")
a = SetLocaleInfo(Korisnik, LOCALE_SLIST, "/")
End Function

Naravno treba i deklaracija na vrhu kao sto si ti sztavila.
Pozdrav
↑  ↓

#5 08.05.2013-11:49
zxz Offline
Administrator
Registrovan/a od: 03.02.2009-16:22
Komentari: 9,692


Subject: Re: Regionalne postavke direktno iz access-a?
Ovo ide u temu api funkcije a ne u koristan kod.
Pozdrav
↑  ↓

#6 08.05.2013-11:50
zxz Offline
Administrator
Registrovan/a od: 03.02.2009-16:22
Komentari: 9,692


Subject: Re: Regionalne postavke direktno iz access-a?
Citat:
Jedino tu nema za podesavanje zareza i tacke?
Na sta mislis?
Pozdrav
↑  ↓

#7 08.05.2013-20:54
Amelasar Offline
Clan
Registrovan/a od: 07.04.2011-18:28
Komentari: 234


Ocjena: Ocjena:100 Subject: Re: Regionalne postavke direktno iz access-a?
Stavila sam poslije:

Call SetLocaleInfo(LCID, LOCALE_SDECIMAL, Dec)
Call SetLocaleInfo(LCID, LOCALE_STHOUSAND, Gru)

Ok u API funkcije Wink
Pozdrav, Amela
↑  ↓

Stranice (1): 1


All times are GMT +01:00. Current time: 20.06.2018-21:34.