Archive for December, 2008

How to assign actions to keys?

Thursday, December 11th, 2008

1 - Create an order form in structure and event 'Clicking' on the properties of the form enter the following: me.keypreview = true
Or is this going to make the keyboard events are received in the first form.

2 - In the form properties, the event 'button below to' put the following code:

Private Sub Form_KeyDown (KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyF2
DoCmd.OpenForm "Form1"
Case vbKeyF3
DoCmd.OpenForm "Form2"
Case vbKeyF4
DoCmd.OpenForm "formulario3"
Case vbKeyF5
As Double Dim Calculator
Calculator = Shell ("calc.exe", vbNormalFocus)
Case vbKeyF6
DoCmd.Close
Case Else
End Select
End Sub

What this does is the following:
- By pressing the F2 key opens the form1
- By pressing the F3 key opens Form2
- By pressing the F4 key opens the formulário3
- By pressing the F5 key opens the Windows Calculator
- By pressing the F6 key closes the form

In addition to the function key F1, F2 ... etc, we can also use any other button to perform functions, but keeping in mind that if we are to enter data in a form not suitable to use keys that are used to write data in the fields.
Another thing is that it only works on the form where you put the above codes.

Download: Keys
Example shortcut keys

Presentation

Avatar

Thank you for visiting.
Subscribe to feed not to miss any messages.

Here in blog I will provide examples of working with Microsoft Access and also ask questions to those who ask. More

Want to subscribe?

Subscribe or subscribe by email:
Enter your email:


Ads