Hi Kumar
Here's a version of that code that works in VBA:
Private Declare Function GetKeyState _
Lib "user32" ( _
ByVal nVirtKey As Long _
) As Integer
Public Function IsCapsLockOn() As Boolean
Dim iKeyState As Integer
iKeyState = GetKeyState(vbKeyCapital)
IsCapsLockOn = (iKeyState And 1) <> 0
End Function
-- Graham
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of John Viescas
Sent: Monday, 6 June 2011 05:34
To: MS_Access_Professionals@yahoogroups.com
Subject: RE: [MS_AccessPros] Re: Login Form
Kumar-
KeyPress returns nothing, but KeyDown returns a 20 as the KeyCode.
But you would have to trap everywhere to detect the key being pressed. What
you
really need to do is call Windows to find out the status of the keyboard.
Code
to do it can be found here:
http://blogs.msdn.com/b/michkap/archive/2006/03/29/562606.aspx
John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)
-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
[mailto:MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com> ] On Behalf Of access_kri
Sent: Sunday, June 05, 2011 7:06 PM
To: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
Subject: [MS_AccessPros] Re: Login Form
JOHN-
Thanks for your prompt response. The BeforeUpdate event procedure as
suggested by you, gives message after password in entered. However, I want
the
warning when the focus is on the password field and even before the user
presses
any key. What is the ASCII key for caps lock key?
Thanks and Regards,
Kumar
--- In MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com> , "John Viescas"
<john@...> wrote:
>
> Kumar-
>
> I'm not sure if KeyPress or KeyDown will give you that info. You could
check
> the entered data in the password control's BeforeUpdate event to see if
they
> entered all caps and warn them then.
>
> Use the StrComp function to do a case-sensitive compare:
>
> If StrComp(Me.Pswd, UCase(Me.Pswd), vbBinaryCompare) = 0 Then
> MsgBox "You might have Caps Lock turned on."
> End If
>
> John Viescas, author
> Microsoft Office Access 2010 Inside Out
> Microsoft Office Access 2007 Inside Out
> Building Microsoft Access Applications
> Microsoft Office Access 2003 Inside Out
> SQL Queries for Mere Mortals
> http://www.viescas.com/
> (Paris, France)
>
>
> -----Original Message-----
> From: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
> [mailto:MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com> ] On Behalf Of access_kri
> Sent: Sunday, June 05, 2011 6:00 PM
> To: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
> Subject: [MS_AccessPros] Login Form
>
> Dear all,
> I have a log-in form, which has case-sensitive password field. I want
a
> warning to be displayed in a label when the CAPS Lock is on similar to
when it
> is displayed when we log-on to windows. Can you suggest how I can
accomplish
> this.
>
> Thanks and regards,
> Kumar
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
------------------------------------
Yahoo! Groups Links
[Non-text portions of this message have been removed]
Minggu, 05 Juni 2011
RE: [MS_AccessPros] Re: Login Form
__._,_.___
MARKETPLACE
.
__,_._,___
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar