H geocities.com /Heartland/Pond/4805/Toggle_Capslock.htm geocities.com/Heartland/Pond/4805/Toggle_Capslock.htm .delayed x PJ 1 t OK text/html h t b.H Sun, 20 Jan 2002 13:04:20 GMT e Mozilla/4.5 (compatible; HTTrack 3.0x; Windows 98) en, * PJ t
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.