Is there a way in the form properties to give control to my KeyDown event procedure when F1 is pressed? As it is, I get Access help menu.
Is there a way in the form properties to give control to my KeyDown event procedure when F1 is pressed? As it is, I get Access help menu.
google found a number of threads on the subject - here is one
https://bytes.com/topic/access/answe...-function-keys
Thanks. I stumbled onto the KeyPreview property while I was searching. Setting that property for the form to YES does the trick. One needs an AutoKeys macro when the situation applies to an entire app.
One does have to set KeyCode = 0 to avoid futher "default" processing.
Code:Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyF1 Then KeyCode = 0 MsgBox "Testing F1 for other than default use." End If End Sub
I prefer to use case statements:
Code:Private Sub Form_KeyDown1(KeyCode As Integer, Shift As Integer) Select Case KeyCode Case vbKeyF1 KeyCode = 0 MsgBox "Testing F1 for other than default use." Case vbKeyF2 Case Else MsgBox "Warning! Warning!" End Select End Sub
GOOD POINT!!! I've added the "Case" of the user hitting another key.