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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

932 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

8 Experts available now in Live!

Get 1:1 Help Now