?
Solved

microsoft access vba coding to enable a form when the the user presses the shift ctrl alt x keys simultaneously

Posted on 2010-11-10
4
Medium Priority
?
670 Views
Last Modified: 2013-11-28
I need vba help in coding a combination of "hot keys" such that on the current event of the form, if the user presses the 'shift' 'ctrl' 'alt' 'x' keys simultaneously, the form is enabled.  Right now the form opens disabled on the open event.  No idea how to this programatically..........
0
Comment
Question by:sxxgupta
[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
  • 2
  • 2
4 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 2000 total points
ID: 34104306
A Form does not have an "Enabled'  property, so ... not sure what you are referring to ?

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

Example of use:

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
   
    If Shift =7 Then  ' Shift + Ctrl + Alt Keys
        If KeyCode = vbKeyX Then
               ' do something here.
        End If
End Sub

mx

0
 

Author Closing Comment

by:sxxgupta
ID: 34104354
Sorry, meant to say enable a subform within a form.......Thank you for the example!!!!
0
 
LVL 75
ID: 34104403
ahh ... subform. ok.

Keep that list handy ... not easy to come by ...

mx
0
 

Author Comment

by:sxxgupta
ID: 34110794
Will do MX..........works like a charm.  Thanks again.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

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.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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.
Suggested Courses

770 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