CAPS Lock

G

Guest

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: (e-mail address removed)

'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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top