Proviso : bear in mind that different Windows operating system versions have different support for languages – with Windows 7 you require ultimate version of the OS and then you have to ensure that the required language pack is installed – happy to say that Win 8 has language support as standard although you will need to specifically request certain regional input options within the settings. Windows 10 is similar, language support is free although it is likely you will have to specifically configure languages if there is more than one. My environment when I first solved this was Windows 7 ultimate.
So the problem – You are multi-lingual (or trying to be) and you regurlaly need to change mapping of your keyboard between alphabets (you can also touch type in both alphabets). You can do it manually everytime you need to change but it’s a pain, you have a database with fields some of which are in one language the others of which are in another language. You would like to alter keyboard mapping to specific languages on entering particular fields but how do you do it?
The following uses the Windows API to change the keyboard language globally. This can be done through VBA in MS Access no problem remembering the provisio that your OS must support your chosen language.
Firstly place the following in a module (note no end function required)
Public Declare Function ActivateKeyboardLayout Lib "user32.dll" (ByVal myLanguage As Long, Flag As Boolean) As Long 'define your desired keyboardlanguage
Then you can call the function from any form event.
Eg on field GotFocus and LostFocus
'1049 Russian keyboard language layout
'2057 English(United Kingdom)keyboard language layout
'1033 English (United States) keyboard language layout
Private Sub A_GotFocus()
Call ActivateKeyboardLayout(1049, 0)
Private Sub A_LostFocus()
Call ActivateKeyboardLayout(2057, 0)
You can find the LCID decimal codes here
Microsoft Windows Location Identifier Codes LCID