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
628 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
  • 2
  • 2
4 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 500 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

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Dcount unique 6 24
Loop within Select Case 3 25
Help with SQl and UNION 3 19
Syntax using Declare 3 11
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now