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.
- 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
- On the Tools menu, click References. Make sure there is a reference to Microsoft Office 9.0 Object Library.
- 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
- Type the following line in the Immediate window, and then press ENTER: