Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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
?
682 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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
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.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

604 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