INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Detecting Capslock On Login Screen Access Form

Detecting Capslock On Login Screen Access Form

(OP)
thread705-1299579: Detecting Caps Lock

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?

RE: Detecting Capslock On Login Screen Access Form

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

RE: Detecting Capslock On Login Screen Access Form

(OP)
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.

RE: Detecting Capslock On Login Screen Access Form

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

RE: Detecting Capslock On Login Screen Access Form

(OP)
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?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close