Sep 18, 2003 #1 Krystoff MIS Sep 18, 2002 129 US Hey all! Heres a quick question on autokeys. I have a form, there is a button on the form called cmdSearch. From anywhere in that form, I want the user to be able to press the F12 function key and have it be the same as if they had clicked that button. Any ideas?
Hey all! Heres a quick question on autokeys. I have a form, there is a button on the form called cmdSearch. From anywhere in that form, I want the user to be able to press the F12 function key and have it be the same as if they had clicked that button. Any ideas?
Sep 18, 2003 #2 cghoga Programmer Jun 26, 2003 614 US You'll need to include code in the form's on load and KeyDown Procs. Please see below. Private Sub Form_Load() Me.KeyPreview = True End Sub Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) Select Case KeyCode Case vbKeyF12 'Enter Your code here. End Select End Sub hope this helps you. Upvote 0 Downvote
You'll need to include code in the form's on load and KeyDown Procs. Please see below. Private Sub Form_Load() Me.KeyPreview = True End Sub Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) Select Case KeyCode Case vbKeyF12 'Enter Your code here. End Select End Sub hope this helps you.
Sep 18, 2003 Thread starter #3 Krystoff MIS Sep 18, 2002 129 US That works really well! Thanks cghoga! Upvote 0 Downvote