Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting Capslock On Login Screen Access Form

Status
Not open for further replies.

StanJx

Programmer
Jun 2, 2016
29
0
0
LK
thread705-1299579

I found this thread and its useful to what I am looking to do. But I need something different than what happens in this thread. I require a notification to show on my login screen (text box) stating that the Capslock is on if the Capslock button is on. And the notification becomes blank when Capslock is turned off. Is there anyway of doing this? Could you help me with the code?
 
Yes there is a way of doing it, but you haven't provided any code or description of your form, any controls you may have, nothing?

This function
Code:
Option Compare Database
Option Explicit

Private Declare Sub GetKeyboardState Lib "user32" (lpKeyState As Any)
Const VK_CAPITAL = &H14

Public Function CapsOn() As Boolean
    
    ReDim KeyboardBuffer(256) As Byte

    'Array to check capslock
    GetKeyboardState KeyboardBuffer(0)

    If KeyboardBuffer(VK_CAPITAL) Then
        CapsOn = True
    Else
        CapsOn = False
    End If
    
End Function
simply returns true or false if caps lock is on or not, in that context this statement makes no sense "But I need something different than what happens in this thread." All that happens in this thread is a discussion takes place regarding code to check if caps lock is on or not.

Did you not want a discussion about how to solve your problem? As that's all that happens in TT threads, not sure what other outcome you are expecting?



"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
 
I'm a bit of a beginner when it comes to modules. I need the function to work when my Access system login form opens. My login form goes frmLogin. What I need is to get a notification on the login form saying that capslock is on (if capslock is on). And I want the notification to disappear when capslock is turned off. Would appriciate if you can help me with the code completely.
 
The simplest solution IMO would be to have a label on the form that has a caption of 'Caps Lock On'

Then on the form open event.
Code:
Me.NameOfLabelControl.Visible = CapsOn()

As for toggling when pressed, perhaps you need a timer event every 100th of a second to run the same code?

My tests with form key press were unsuccessful

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
 
If there is any different method to cater to my requirement I am all for it. Is there any way to get a string output to a text box on a capslock on off function?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top