CAPS Lock

D

Dwight

Is it possible to determine if the user has his/her Caps Lock on? I would
like to display a messge to the user if he/she enters a texbox and the cap
locks are on.

Thanks in advance!

Dwight
 
W

Wayne Morgan

Word's VBA has this built in, but with Access I believe you'll have to use
API calls. This used a function example from those listed below as it's
basis.

KPD-Team 1999
URL: http://www.allapi.net/
E-Mail: [email protected]

'Keyboard State
Const VK_CAPITAL = &H14
Const VK_NUMLOCK = &H90
Const VK_SCROLL = &H91
Private Type KeyboardBytes
kbByte(0 To 255) As Byte
End Type
Declare Function GetKeyboardState Lib "user32" (kbArray As KeyboardBytes) As
Long

Public Function CapTest() As Boolean
Dim kbArray As KeyboardBytes
GetKeyboardState kbArray
CapTest = kbArray.kbByte(VK_CAPITAL)
End Function
 
Top