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
642 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
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…

825 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