Solved

Finding out if the "shift" key is being held down.

Posted on 2008-10-23
6
321 Views
Last Modified: 2013-11-27
Is there a way in Access 2003 to find out if the "shift" key is being held down?  When a label is double clicked, I want one thing to happen if "shift" is held down and another thing to happen if it is not being held down.
0
Comment
Question by:Declan_Basile
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 8

Accepted Solution

by:
fabriciofonseca earned 500 total points
ID: 22786246
1 - Change the form property "Key preview" to "Yes"
2 - In the event Form_KeyDown write     Debug.Print KeyCode, Shift

The KeyCode is the ASCII number of the key and shift is 0 or 1 whether pressed or not.


Regards
0
 
LVL 44

Expert Comment

by:GRayL
ID: 22786314
Not sure I follow you.  I'm running Access 2003 and there are no events associated with a label.  How are you going to detect whether a label has been double-clicked?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 22786398
Ray,
you must be looking at a label attached to a control..
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 8

Expert Comment

by:fabriciofonseca
ID: 22786541
Please see the attachment example with a possible solution


Regards
DoubleClickShift.mdb
0
 
LVL 75
ID: 22787526
"and shift is 0 or 1 whether pressed or not."

That is not accurate. This is the drill:

Here are the 7 combinations of the Shift argument ... from which you can trap any combination of Shift, Control and Alt ... in either the Form_KeyDown and Form_KeyUp events.  Also ... be SURE you have Key Preview set to Yes on the Event property sheet for the form.

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
   
   'Shift Argument for the 7 combinations of Shift, Ctrl and Alt keys:
   '0 None
   '1 Shift Key
   '2 Ctrl Key
   '3 Shift + Ctrl Keys
   '4 Alt Key
   '5 Shift + Alt Keys
   '6 Ctrl + Alt Keys
   '7 Shift + Ctrl + Alt Keys
   '----------------------------------------
   
End Sub

0
 
LVL 44

Expert Comment

by:GRayL
ID: 22787910
Rey:  That'll do it every time!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question