MartyConnelly
martyconnelly at shaw.ca
Fri Mar 11 16:26:21 CST 2005
Here is another way via LCID to get a possible currency symbol Note difference in call to systemdefault and userdefault Mine is US for system but Canada for User If you want to get into the horrors , shudder, of say the thousand seperator symbols and differences in placement of - negative numbers for various currencies see Randy Birch's method http://vbnet.mvps.org/index.html?code/locale/index.html I notice if you choose Swahili which is Kenya's national language as opposed to English the Official language it uses an S as the currency symbol. But swahili is spoken in about 6 other countries Private Declare Function GetThreadLocale Lib "kernel32" () As Long Declare Function GetSystemDefaultLCID Lib "kernel32" () As Long Declare Function GetUserDefaultLCID Lib "kernel32" () As Long Private 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 Const LOCALE_ILANGUAGE As Long = &H1 'language id Const LOCALE_SLANGUAGE As Long = &H2 'localized name of lang Const LOCALE_SENGLANGUAGE As Long = &H1001 'English name of lang Const LOCALE_SABBREVLANGNAME As Long = &H3 'abbreviated lang name Const LOCALE_SNATIVELANGNAME As Long = &H4 'native name of lang Const LOCALE_ICOUNTRY As Long = &H5 'country code Const LOCALE_SCOUNTRY As Long = &H6 'localized name of country Const LOCALE_SENGCOUNTRY As Long = &H1002 'English name of country Const LOCALE_SABBREVCTRYNAME As Long = &H7 'abbreviated country name Const LOCALE_SNATIVECTRYNAME As Long = &H8 'native name of country Const LOCALE_SINTLSYMBOL As Long = &H15 'intl monetary symbol Const LOCALE_SCURRENCY As Long = &H14 'local monetary symbol Const LOCALE_IDEFAULTLANGUAGE As Long = &H9 'def language id Const LOCALE_IDEFAULTCOUNTRY As Long = &HA 'def country code Const LOCALE_IDEFAULTCODEPAGE As Long = &HB 'def oem code page Const LOCALE_IDEFAULTANSICODEPAGE As Long = &H1004 'def ansi code page Const LOCALE_IDEFAULTMACCODEPAGE As Long = &H1011 'def mac code page Const LOCALE_IMEASURE As Long = &HD '0 = metric, 1 = US '#if(WINVER >= &H0400) Const LOCALE_SISO639LANGNAME As Long = &H59 'ISO abbreviated language name Const LOCALE_SISO3166CTRYNAME As Long = &H5A 'ISO abbreviated country name '#endif /* WINVER >= as long = &H0400 */ '#if(WINVER >= &H0500) Const LOCALE_SNATIVECURRNAME As Long = &H1008 'native name of currency Const LOCALE_IDEFAULTEBCDICCODEPAGE As Long = &H1012 'default ebcdic code Page Const LOCALE_SSORTNAME As Long = &H1013 'sort name '#endif /* WINVER >= &H0500 */ Dim LCID As Long Sub test() Debug.Print GetCurrencyName Debug.Print GetLanguageName Debug.Print GetCountryName Debug.Print GetCurrencySymbol Debug.Print GetLocalCurrencySymbol End Sub '--------------------------------------------------------------------------- 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 '--------------------------------------------------------------------------- Public Function GetLanguageName() '--------------------------------------------------------------------------- LCID = GetSystemDefaultLCID() GetLanguageName = GetUserLocaleInfo(LCID, LOCALE_SENGLANGUAGE) End Function Public Function GetCurrencyName() '--------------------------------------------------------------------------- LCID = GetSystemDefaultLCID() GetCurrencyName = GetUserLocaleInfo(LCID, LOCALE_SNATIVECURRNAME) End Function Public Function GetCountryName() '-------------------------------------------------------------------------- 'LCID = GetSystemDefaultLCID() LCID = GetUserDefaultLCID() GetCountryName = GetUserLocaleInfo(LCID, LOCALE_SNATIVECTRYNAME) End Function Public Function GetCurrencySymbol() '--------------------------------------------------------------------------- 'LCID = GetSystemDefaultLCID() LCID = GetUserDefaultLCID() GetCurrencySymbol = GetUserLocaleInfo(LCID, LOCALE_SINTLSYMBOL) End Function Public Function GetLocalCurrencySymbol() '--------------------------------------------------------------------------- 'LCID = GetSystemDefaultLCID() LCID = GetUserDefaultLCID() GetLocalCurrencySymbol = GetUserLocaleInfo(LCID, LOCALE_SCURRENCY) End Function Erwin Craps - IT Helps wrote: >Had to do this many times in W95/98 with early EURO migrations.... > >-----Original Message----- >From: accessd-bounces at databaseadvisors.com >[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin >- Beach Access Software >Sent: Friday, March 11, 2005 3:12 PM >To: Access Developers discussion and problem solving >Subject: Re: [AccessD] OT: Currency Display > >Erwin: > >I can't believe it. It works! What a dope I feel like! Who'd have >believed that they'd implement a not in list for that field? > >Anyway. Thanks. That solves a big problem. > >Regards, > >Rocky Smolin >Beach Access Software >http://www.e-z-mrp.com >858-259-4334 > >----- Original Message ----- >From: "Erwin Craps - IT Helps" <Erwin.Craps at ithelps.be> >To: "Access Developers discussion and problem solving" ><accessd at databaseadvisors.com> >Sent: Friday, March 11, 2005 12:52 AM >Subject: RE: [AccessD] OT: Currency Display > > > > >>I know >>But dont click on the combo box, just type any text you want in the >>field... >> >>-----Original Message----- >>From: accessd-bounces at databaseadvisors.com >>[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky >> >> >Smolin > > >>- Beach Access Software >>Sent: Friday, March 11, 2005 1:01 AM >>To: Access Developers discussion and problem solving >>Subject: Re: [AccessD] OT: Currency Display >> >>Erwin: >> >>The button next to the language selection is labeled Customize and >> >> >opens > > >>a dialog box where you can select a currency symbol from a combo box, >>but that only shows R, $ and the euro symbol. No option on my system >> >> >to > > >>input your own symbol. Do you have that option on your system? >> >>Thanks and Regards, >> >>Rocky Smolin >>Beach Access Software >>http://www.e-z-mrp.com >>858-259-4334 >> >>----- Original Message ----- >>From: "Erwin Craps - IT Helps" <Erwin.Craps at ithelps.be> >>To: "Access Developers discussion and problem solving" >><accessd at databaseadvisors.com> >>Sent: Thursday, March 10, 2005 1:46 PM >>Subject: RE: [AccessD] OT: Currency Display >> >> >> >> >>>In the regional settings you can choose English sout Africa and you >>> >>> >>will >> >> >>>have a R as prefix. >>>If you really want RSh you can click on the buttom next to it >>> >>> >>(change?) >> >> >>>and just type anything you want in curency symbol... >>>However, this would be necesary on every computer. >>> >>>Erwin >>> >>>-----Original Message----- >>>From: accessd-bounces at databaseadvisors.com >>>[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky >>> >>> >>Smolin >> >> >>>- Beach Access Software >>>Sent: Thursday, March 10, 2005 10:13 PM >>>To: Access Developers discussion and problem solving >>>Subject: Re: [AccessD] OT: Currency Display >>> >>>What I may have to do is add a new option to my Preferences form - >>>Currency symbol. Ack. >>> >>>Rocky >>> >>>----- Original Message ----- >>>From: "MartyConnelly" <martyconnelly at shaw.ca> >>>To: "Access Developers discussion and problem solving" >>><accessd at databaseadvisors.com> >>>Sent: Thursday, March 10, 2005 10:00 AM >>>Subject: Re: [AccessD] OT: Currency Display >>> >>> >>> >>> >>>>Or maybe a display format like >>>> >>>>#,00"RSh"; -#,00"RSh" >>>> >>>>Rocky Smolin - Beach Access Software wrote: >>>> >>>> >>>> >>>>>Dear List: >>>>> >>>>>This is really a Windows question, I believe. >>>>>I have a prospect in Kenya who needs the currency fields to display >>>>> >>>>> >>>RSh >>> >>> >>>>>instead of $. In the regional and language settings there are >>>>> >>>>> >>several >> >> >>>>>selections for English, like Zimbabwe which displays Z$ for the >>>>> >>>>> >>>currency >>> >>> >>>>>field. You can also customize the currency symbol but only $ and >>>>> >>>>> >the > > >>>euro >>> >>> >>>>>symbol are in my combo box. >>>>> >>>>>Does anyone know how to customize this setting so I can display RSh? >>>>> >>>>>MTIA, >>>>> >>>>>Rocky Smolin >>>>>Beach Access Software >>>>>http://www.e-z-mrp.com >>>>>858-259-4334 >>>>> >>>>> >>>>> >>>>-- >>>>Marty Connelly >>>>Victoria, B.C. >>>>Canada >>>> >>>> >>>> >>>>-- >>>>AccessD mailing list >>>>AccessD at databaseadvisors.com >>>>http://databaseadvisors.com/mailman/listinfo/accessd >>>>Website: http://www.databaseadvisors.com >>>> >>>> >>>> >>>-- >>>AccessD mailing list >>>AccessD at databaseadvisors.com >>>http://databaseadvisors.com/mailman/listinfo/accessd >>>Website: http://www.databaseadvisors.com >>>-- >>>AccessD mailing list >>>AccessD at databaseadvisors.com >>>http://databaseadvisors.com/mailman/listinfo/accessd >>>Website: http://www.databaseadvisors.com >>> >>> >>> >>-- >>AccessD mailing list >>AccessD at databaseadvisors.com >>http://databaseadvisors.com/mailman/listinfo/accessd >>Website: http://www.databaseadvisors.com >>-- >>AccessD mailing list >>AccessD at databaseadvisors.com >>http://databaseadvisors.com/mailman/listinfo/accessd >>Website: http://www.databaseadvisors.com >> >> >> > > > -- Marty Connelly Victoria, B.C. Canada