Link to home
Start Free TrialLog in
Avatar of Declan Basile
Declan BasileFlag for United States of America

asked on

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

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.
ASKER CERTIFIED SOLUTION
Avatar of fabriciofonseca
fabriciofonseca
Flag of Brazil image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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?
Ray,
you must be looking at a label attached to a control..
Please see the attachment example with a possible solution


Regards
DoubleClickShift.mdb
"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

Rey:  That'll do it every time!