Where is user's language property in Access?

I have an Access97 database(on Win95 machine) which connects to a POP3 server and downloads email generated by a web site.  One of the bits of information I can get is the date from the email message header, which I receive as text.  I want to convert this to date format so Access can manipulate it.

Normally I would say e.g. CDate("13 Oct 1999") and have no problems.  BUT I am working in Brazil and most people here have Office installed in Portuguese (however, some have English).  Microsoft being clever-boots that it is, has translated EVERYTHING into Portuguese, even built-in functions.  The CDate in Portuguese Access does not understand English date formats (October = Outobre in Portuguese, it is expecting "13 Out 1999" instead).  However the date information is taken from the email header info, which is controlled by the ISP server, which is in English format and beyond my power to change.

I want to put in a check that looks up whether the user has Portuguese or English Access installed, and then either converts the date to Portuguese via a function, or leaves it alone.  Something like this:

select case (whatlanguageofAccessdoesthiscomputerhave)
case (english)
case (brazilianportuguese)
end select

Does anybody know how to look up what language Access is installed in?  It's gotta be a property somewhere but I can't find it.


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.

From the Knowledge base - a kludge, but workable...

Function Language ()
Select Case Error$(3)
  Case "Return without GoSub":            Language = "English"
         Case "Return sans GoSub":            Language = "French"
         Case "'Return' ohne 'GoSub'":            Language = "German"
         Case "Return sem GoSub":            Language = "Portuguese"
         Case "Return sin GoSub":            Language = "Spanish"
      End Select  

End Function

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
pentapodAuthor Commented:
Hi - thanks, it does work, but as you say it's a kludge.  Not very elegant.  I'll give you the points next week, but I'll increase them to 150 if you can tell me the "proper" way of accessing the language property.  

I know it must be somewhere because when I load up my database (written in English Access) on a Portuguese machine it has actually parsed and translated all my code into Portuguese.

Now() becomes Agora()
iif(a,b,c) becomes selmed(a,b,c)

asking for trouble if you ask me... but it means that Access must have some way of knowing.

I don't know if you'll find anything more elegant - that was the Microsoft Knowledge Base answer, so I suspect that the language designation is buried pretty well. (Not that I think that MS is always the best source!)

I can't find any API magic to do this - maybe some wizard with arcane knowledge of Access internals will post something...
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

pentapodAuthor Commented:
OK, well, it works, I will accept your answer on Monday just in case any Access Wizards have any more suggestions before then (probably not by the sounds of it).


Testing 123

I have had problems posting to this question. Just testing.
' Copy From here
' ---Posted by Dev Ashish---
' Retrieve Locale Info
' (Q)    How do I retrieve Locale specific information, such as Country Name, from Registry?
' (A)    Use the included function fLocaleInfo. Pass it one of the declared constants, depending on what value you want to retrieve.

'************* Code Start ************
Public Const LOCALE_ILANGUAGE = &H1         '  language id
Public Const LOCALE_SLANGUAGE = &H2         '  localized name of language
Public Const LOCALE_SENGLANGUAGE = &H1001   '  English name of language
Public Const LOCALE_SABBREVLANGNAME = &H3   '  abbreviated language name
Public Const LOCALE_SNATIVELANGNAME = &H4   '  native name of language
Public Const LOCALE_ICOUNTRY = &H5          '  country code
Public Const LOCALE_SCOUNTRY = &H6          '  localized name of country
Public Const LOCALE_SENGCOUNTRY = &H1002    '  English name of country
Public Const LOCALE_SABBREVCTRYNAME = &H7   '  abbreviated country name
Public Const LOCALE_SNATIVECTRYNAME = &H8   '  native name of country
Public Const LOCALE_IDEFAULTLANGUAGE = &H9  '  default language id
Public Const LOCALE_IDEFAULTCOUNTRY = &HA   '  default country code
Public Const LOCALE_IDEFAULTCODEPAGE = &HB  '  default code page
Public Const LOCALE_SLIST = &HC             '  list item separator
Public Const LOCALE_IMEASURE = &HD          '  0 = metric, 1 = US
Public Const LOCALE_SDECIMAL = &HE          '  decimal separator
Public Const LOCALE_STHOUSAND = &HF         '  thousand separator
Public Const LOCALE_SGROUPING = &H10        '  digit grouping
Public Const LOCALE_IDIGITS = &H11          '  number of fractional digits
Public Const LOCALE_ILZERO = &H12           '  leading zeros for decimal
Public Const LOCALE_SNATIVEDIGITS = &H13    '  native ascii 0-9
Public Const LOCALE_SCURRENCY = &H14        '  local monetary symbol
Public Const LOCALE_SINTLSYMBOL = &H15      '  intl monetary symbol
Public Const LOCALE_SMONDECIMALSEP = &H16   '  monetary decimal separator
Public Const LOCALE_SMONTHOUSANDSEP = &H17  '  monetary thousand separator
Public Const LOCALE_SMONGROUPING = &H18     '  monetary grouping
Public Const LOCALE_ICURRDIGITS = &H19      '  # local monetary digits
Public Const LOCALE_IINTLCURRDIGITS = &H1A  '  # intl monetary digits
Public Const LOCALE_ICURRENCY = &H1B        '  positive currency mode
Public Const LOCALE_INEGCURR = &H1C         '  negative currency mode
Public Const LOCALE_SDATE = &H1D            '  date separator
Public Const LOCALE_STIME = &H1E            '  time separator
Public Const LOCALE_SSHORTDATE = &H1F       '  short date format string
Public Const LOCALE_SLONGDATE = &H20        '  long date format string
Public Const LOCALE_STIMEFORMAT = &H1003    '  time format string
Public Const LOCALE_IDATE = &H21            '  short date format ordering
Public Const LOCALE_ILDATE = &H22           '  long date format ordering
Public Const LOCALE_ITIME = &H23            '  time format specifier
Public Const LOCALE_ICENTURY = &H24         '  century format specifier
Public Const LOCALE_ITLZERO = &H25          '  leading zeros in time field
Public Const LOCALE_IDAYLZERO = &H26        '  leading zeros in day field
Public Const LOCALE_IMONLZERO = &H27        '  leading zeros in month field
Public Const LOCALE_S1159 = &H28            '  AM designator
Public Const LOCALE_S2359 = &H29            '  PM designator
Public Const LOCALE_SDAYNAME1 = &H2A        '  long name for Monday
Public Const LOCALE_SDAYNAME2 = &H2B        '  long name for Tuesday
Public Const LOCALE_SDAYNAME3 = &H2C        '  long name for Wednesday
Public Const LOCALE_SDAYNAME4 = &H2D        '  long name for Thursday
Public Const LOCALE_SDAYNAME5 = &H2E        '  long name for Friday
Public Const LOCALE_SDAYNAME6 = &H2F        '  long name for Saturday
Public Const LOCALE_SDAYNAME7 = &H30        '  long name for Sunday
Public Const LOCALE_SABBREVDAYNAME1 = &H31  '  abbreviated name for Monday
Public Const LOCALE_SABBREVDAYNAME2 = &H32  '  abbreviated name for Tuesday
Public Const LOCALE_SABBREVDAYNAME3 = &H33  '  abbreviated name for Wednesday
Public Const LOCALE_SABBREVDAYNAME4 = &H34  '  abbreviated name for Thursday
Public Const LOCALE_SABBREVDAYNAME5 = &H35  '  abbreviated name for Friday
Public Const LOCALE_SABBREVDAYNAME6 = &H36  '  abbreviated name for Saturday
Public Const LOCALE_SABBREVDAYNAME7 = &H37  '  abbreviated name for Sunday
Public Const LOCALE_SMONTHNAME1 = &H38      '  long name for January
Public Const LOCALE_SMONTHNAME2 = &H39      '  long name for February
Public Const LOCALE_SMONTHNAME3 = &H3A      '  long name for March
Public Const LOCALE_SMONTHNAME4 = &H3B      '  long name for April
Public Const LOCALE_SMONTHNAME5 = &H3C      '  long name for May
Public Const LOCALE_SMONTHNAME6 = &H3D      '  long name for June
Public Const LOCALE_SMONTHNAME7 = &H3E      '  long name for July
Public Const LOCALE_SMONTHNAME8 = &H3F      '  long name for August
Public Const LOCALE_SMONTHNAME9 = &H40      '  long name for September
Public Const LOCALE_SMONTHNAME10 = &H41     '  long name for October
Public Const LOCALE_SMONTHNAME11 = &H42     '  long name for November
Public Const LOCALE_SMONTHNAME12 = &H43     '  long name for December
Public Const LOCALE_SABBREVMONTHNAME1 = &H44 '  abbreviated name for January
Public Const LOCALE_SABBREVMONTHNAME2 = &H45 '  abbreviated name for February
Public Const LOCALE_SABBREVMONTHNAME3 = &H46 '  abbreviated name for March
Public Const LOCALE_SABBREVMONTHNAME4 = &H47 '  abbreviated name for April
Public Const LOCALE_SABBREVMONTHNAME5 = &H48 '  abbreviated name for May
Public Const LOCALE_SABBREVMONTHNAME6 = &H49 '  abbreviated name for June
Public Const LOCALE_SABBREVMONTHNAME7 = &H4A '  abbreviated name for July
Public Const LOCALE_SABBREVMONTHNAME8 = &H4B '  abbreviated name for August
Public Const LOCALE_SABBREVMONTHNAME9 = &H4C '  abbreviated name for September
Public Const LOCALE_SABBREVMONTHNAME10 = &H4D '  abbreviated name for October
Public Const LOCALE_SABBREVMONTHNAME11 = &H4E '  abbreviated name for November
Public Const LOCALE_SABBREVMONTHNAME12 = &H4F '  abbreviated name for December

Public Const LOCALE_USER_DEFAULT& = &H400

Const cMAXLEN = 255

Private Declare Function apiGetLocaleInfo Lib "kernel32" _
    Alias "GetLocaleInfoA" (ByVal Locale As Long, _
    ByVal LCType As Long, ByVal lpLCData As String, _
    ByVal cchData As Long) As Long

Function fLocaleInfo(lngLCType As Long) As String
Dim lngLocale As Long
Dim strLCData As String, lngData As Long
Dim lngX As Long

    strLCData = String$(cMAXLEN, 0)
    lngData = cMAXLEN - 1
    lngX = apiGetLocaleInfo(LOCALE_USER_DEFAULT, lngLCType, _
                    strLCData, lngData)
    If lngX <> 0 Then
        fLocaleInfo = Left$(strLCData, lngX - 1)
    End If
End Function
' Copy To here
Try this:

Copy/Paste the code below into a code module.

Print Nz(fLocaleInfo(LOCALE_SENGLANGUAGE), "")

resulting in Norwegian (Bokmal)


resulting in nor

There are much more settings to be retrieved using this function...
Seems it did not like a character from my local languange, hmmm....

See if you can use this function. It is a bit more elegant, it uses the settings from the control panel and it is quite general.
pentapodAuthor Commented:
OK, I'm impressed Tryqve.  That's brilliant.

So how do I split points between the two of you?

The best idea is normally to post a request in the Customer Service area for a point split. The officials will then often award you extra points which you can use for the purpose. The request should include a ref to the question and some words of why you want to split the points.

If you don't do this, you will most likely have to post another question spending "your own" credit points. Go for the request alternative :-))
I love the new information, but suggest you watch out for any possible mismatch between the registry locale and the Access language version - I think it's possible to have the Portugese version of Access on a machine with another locale.

Whether this is likely (or important in your case) depends on your situation - if you are sure of a match the registry solution is more elegant and provides much more utility.
It is the regional settings that decide how the date is presented to you in Access. I have English Access, but Norwegian regional settings. This means that dates come with Norwegian month names in my applications.
pentapodAuthor Commented:
OK, I will go try the Customer Service area.  Two good answers, limited points, what's a girl to do?


pentapodAuthor Commented:
Adjusted points to 150

Pentapod has asked me to split the points on this question, since the question is already locked by psmith789, I will ask pentapod to grade psmith789's answer and close the question, I have posted a question for trygve in this area for his help on the question.

I hope this is satisfactory for everyone concerned.

Any comments or queries, please come to:


Community Support @ Experts Exchange
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
Microsoft Access

From novice to tech pro — start learning today.