Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: Sample Function to Determine Language Version


View products that this article applies to.

This article was previously published under Q210455
Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

↑ Back to the top


Summary

Microsoft Access ships in and can use several languages. This article shows you how to create a sample function that you can use to determine which language version of Access is installed, which language version the user interface is using, and which language version the Help file is using.

↑ Back to the top


More information

Access keeps track of language specific information by associating the files with a Local ID (LCID). This function uses the LanugageID property to return the LCID for different parts of Access. The LCID is passed to the LangID function to resolve the LCID into a friendly name for the language. Not all supported languages are handled in this function, but you can add aditional Case statements to handle additional languages.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
  1. Create a new module and type the following in the Declarations section:
    Option Compare Database
    
    Public 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
    
    Public Const LOCALE_SLANGUAGE = &H2
    					
  2. On the Tools menu, click References. Make sure there is a reference to Microsoft Office 9.0 Object Library.
  3. Type the following procedures:
    Function StLangOfLcid(lcid As Long) As String
    
        Dim st As String
        Dim cch As Long
        
        st = String(256, vbNullChar)
        cch = GetLocaleInfo(lcid, LOCALE_SLANGUAGE, st, Len(st))
        StLangOfLcid = Left(st, cch - 1)
        
    End Function
    					
    Sub FindLanguage()
    
       Debug.Print "The language that is installed is: " & _
          StLangOfLcid(LanguageSettings.LanguageID(msoLanguageIDInstall))
       Debug.Print "The language of the user interface is: " & _
          StLangOfLcid(LanguageSettings.LanguageID(msoLanguageIDUI))
       Debug.Print "The language of the help files is: " & _
          StLangOfLcid(LanguageSettings.LanguageID(msoLanguageIDHelp))
    
    End Sub
    					
  4. Type the following line in the Immediate window, and then press ENTER:
    FindLanguage
    					

↑ Back to the top


References

For more information about Locale identification numbers, click Microsoft Access Help on the Help menu, type LCID in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

↑ Back to the top


Keywords: KB210455, kbprogramming, kbhowto

↑ Back to the top

Article Info
Article ID : 210455
Revision : 5
Created on : 10/11/2006
Published on : 10/11/2006
Exists online : False
Views : 378