?
Solved

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

Posted on 2008-10-23
6
Medium Priority
?
322 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 2000 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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Suggested Courses
Course of the Month12 days, 17 hours left to enroll

777 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