Programme a function key to open a form

  • Thread starter Thread starter Ian Turk
  • Start date Start date
I

Ian Turk

Hello
I am running Access 2002.

Can someone please guide me with the following - I can not find an answer in
help - but may of course just be looking up the wrong place.

I want to be able to open a form by pressing one key - preferably a function
key - from anywhere in the open form.

I understand that I need to set Keypreview to yes for the form. But I am not
sure how to refer to a function key, and then to assign a macro to that key.

Probably (hopefully) very basic, but guidance would be appreciated.


Ian
 
Hi Ian,

I copied this straight from the Access 2000 Help Text.
I hope it helps:

KeyPreview Property Example

In the following example, the KeyPreview property is set
to True (-1) in the form's Load event procedure. This
causes the form to receive keyboard events before they are
received by any control. The form KeyDown event then
checks the KeyCode argument value to determine if the F2,
F3, or F4 keys were pushed.

Private Sub Form_Load()
Me.KeyPreview = True
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As
Integer)
Select Case KeyCode
Case vbKeyF2
' Process F2 key events.
Case vbKeyF3
' Process F3 key events.
Case vbKeyF4
' Process F4 key events.
Case Else
End Select
End Sub

Chuck
 
THanks Chuck - I thought it had to be there, but I often find that my way of
thinking does not correspond with the way the Help is structured.

Regards

Ian
 
Back
Top