Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Custom menu question

Status
Not open for further replies.

wabtrainer

IS-IT--Management
Feb 4, 2002
66
GB
How can I utilise th F1 key from a custom menu?
I have tried to use SendKeys but get an error.
I am using Access 2000.
Cheers


If you want to be a bear:
Be a Grizzly!
 
I'm not exactly sure what you mean by "How can I utilise the F1 key from a custom menu?" but you can assign special functions to most any key by the following VBA code:

'This tells Access to check keys when first pressed
Private Sub Form_Load()
Me.KeyPreview = True
End Sub

'This assigns various keys special functions
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode

Case vbKeyEscape
'Your code here for when Escape is hit

Case vbKeyF1
' Your code here for when F1 key is hit

Case vbKeyF2
' Your code here for when F2 key is hit

Case vbKeyF3
' Your code here for when F3 key is hit

Case Else
End Select
End Sub

While you can assign the F1 key in this manner, you should remember that in doing so, you are doing away with the user's ability to use Access' own help system by pressing the F1 key. This should be kept in mind when reassinging any key that already has a built-in function.

Hope this helps.

The Missinglinq

There's ALWAYS more than one way to skin a cat!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top