Work with Keys in vba

dmarop

Registered User.
Local time
Today, 14:13
Joined
May 17, 2013
Messages
41
Hello,

I have the following code in a form to checked the keys. I want to have and another choice in the case in combination with keys, for example ctrl+q.

Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    On Error Resume Next
    Select Case KeyCode
    Case vbKeyDown
        KeyCode = 0
        DoCmd.GoToRecord , , acNext
    Case vbKeyUp
        KeyCode = 0
        DoCmd.GoToRecord , , acPrevious
    Case vbKeyHome
        DoCmd.GoToRecord , , acFirst
    Case vbKeyEnd
        DoCmd.GoToRecord , , acLast
    End Select

End Sub

Can you help me?

Thank you!

Dimitris
 
So which exact part of the documentation is not clear to you?
 
Your request was kind of vague, could you be more specific?

Here is a Macro Example:
HTH
 

Attachments

  • Ctrlp.jpg
    Ctrlp.jpg
    20.5 KB · Views: 152
Add the below to your code:
Code:
If (Shift And acCtrlMask) And KeyCode = 81 Then
  MsgBox "You pressed the <CTRL>+q"
End If
 
Hello,

Thank you all for your help. The problem is been solved!!


Regards,
Dimitris
 

Users who are viewing this thread

Back
Top Bottom