to run code when user click on CTRL-F

I

iccsi

Is it possible to run code when user click on some control key like
ctrl- F?

Your information is great appreciated,
 
I

iccsi

iccsi -

Look up KeyPreview, which will let you trap keystrokes on a form.

--
Daryl S







- Show quoted text -

Thanks for the message,
I get trap keystorke vbKeyControl or vbKeyF, but can not trap both of
them at same time.
Thanks again,
 
D

Douglas J. Steele

If you're trying in the KeyDown event, use

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If (KeyCode = vbKeyF) And (Shift And acCtrlMask) > 0 Then
MsgBox "Ctrl-F", , "Form_KeyDown"
End If
End Sub

If you're trying in the KeyPress event, use

Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 102 Then
MsgBox "Ctrl-F", , "Form_KeyPress"
End If
End Sub


--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

- Show quoted text -

Thanks for the message,
I get trap keystorke vbKeyControl or vbKeyF, but can not trap both of
them at same time.
Thanks again,
 
S

Stuart McCall

iccsi -

Look up KeyPreview, which will let you trap keystrokes on a form.

--
Daryl S







- Show quoted text -

Thanks for the message,
I get trap keystorke vbKeyControl or vbKeyF, but can not trap both of
them at same time.
Thanks again,

In your form's KeyDown event procedure:

If KeyCode = vbKeyF Then
If (Shift And vbCtrlMask) = vbCtrlMask Then
KeyCode = 0
MsgBox "Ctrl-F was pressed"
End If
End If
 
I

iccsi

Thanks for the message,
I get trap keystorke vbKeyControl or vbKeyF, but can not trap both of
them at same time.
Thanks again,

In your form's KeyDown event procedure:

If KeyCode = vbKeyF Then
    If (Shift And vbCtrlMask) = vbCtrlMask Then
        KeyCode = 0
        MsgBox "Ctrl-F was pressed"
    End If
End If- Hide quoted text -

- Show quoted text -

Thanks millions,
 
I

iccsi

If you're trying in the KeyDown event, use

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If (KeyCode = vbKeyF) And (Shift And acCtrlMask) > 0 Then
        MsgBox "Ctrl-F", , "Form_KeyDown"
    End If
End Sub

If you're trying in the KeyPress event, use

Private Sub Form_KeyPress(KeyAscii As Integer)
    If KeyAscii = 102 Then
        MsgBox "Ctrl-F", , "Form_KeyPress"
    End If
End Sub

--
Doug Steele, Microsoft Access MVPhttp://www.AccessMVP.com/DJSteele
(no e-mails, please!)





Thanks for the message,
I get trap keystorke vbKeyControl or vbKeyF, but can not trap both of
them at same time.
Thanks again,

Thanks millions,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top