Hgeocities.com/Heartland/Pond/4805/Toggle_Capslock.htmgeocities.com/Heartland/Pond/4805/Toggle_Capslock.htm.delayedxPJ1t OKtext/htmlht b.HSun, 20 Jan 2002 13:04:20 GMTeMozilla/4.5 (compatible; HTTrack 3.0x; Windows 98)en, *PJt How to toggle the Caps Lock key in Access

Tells how to toggle the Caps Lock key in Access.
 

Microsoft Knowledgebase article Q101125


Here is the gist of it:

1. Create a module and type the following line in the Declarations section:

    Option Explicit

    Declare Sub GetKeyboardState Lib "User" (ByVal lpKeyState As String)
    Declare Sub SetKeyboardState Lib "User" (ByVal lpKeyState As String)

2. Type the following procedure:

    Function SetKeys ()
    Dim keys As String
    Const VK_CAPITAL = &H14

    keys = Space$(256)

    GetKeyboardState keys

    If &H1 = (Asc(Mid(keys, VK_CAPITAL + 1, 1)) And &H1) Then
         keys = Left(keys, VK_CAPITAL) & Chr(0) & Right(keys, Len(keys) _
            - (VK_CAPITAL + 1))
    Else
         keys = Left(keys, VK_CAPITAL) & Chr(1) & Right(keys, Len(keys) _
           - (VK_CAPITAL + 1))
    End If

    SetKeyboardState keys

    End Function
 

3. To test this function, type the following line in the Immediate window,
and then press ENTER:
  " ? SetKeys() " (without the quotation marks)
  Note that the CAPSLOCK key will toggle from whatever state it was in previously.