Solved

assign F1....F12 function key as a shortcuts,is it possible??

Posted on 2004-08-14
2
1,709 Views
Last Modified: 2008-01-09
hello all
this time I have a question about assigning F1......F12 key function as a shortcut instead of normal shortcuts((((((((Alt+anykey)))))))))) ,I understand that this those keys have their own functions in MSAccess but is there anycode or something to stop their functions and edit them or assign them to do another thing such : open,delete,insert,search as any other botton????????

your help will be appriciated,
thankx alot my dears
 
0
Comment
Question by:wellous
2 Comments
 
LVL 36

Accepted Solution

by:
SidFishes earned 85 total points
Comment Utility
here's a function to set up hotkeys

all you need to do is

Public Function HotKeys(KeyCode As Integer, Shift As Integer, callerForm As String)

Dim intkey As Integer
intkey = KeyCode
KeyCode = 0 'assumption is first made that user-operation key was pressed, therefore keystroke is neutralized.
'If not a user-operational key, then original value will be restored below

Select Case intkey 'check to see if key pressed was an operational key

Case is = 17 'just add case stmts based on the key code values of your fkeys
                   ' you can trap almost any key or combination
end select

End If

Case Else 'key pressed was not an operational key, so reassign original value for data entry
    GoTo abort
End Select
exitsub:
Exit Function

abort:     'see Case Else above
KeyCode = intkey
End Function


then on your form

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

    HotKeys KeyCode, 0

End Sub
0
 
LVL 5

Author Comment

by:wellous
Comment Utility
hello sidfishes

I found the answer at the internet and between your lines,and here it is


Private Sub Form_Load()
Me.KeyPreview = True

End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

Select Case KeyCode
Case vbKeyF2
DoCmd.OpenForm "............fomname,,,,"
Case vbKeyF3
DoCmd.OpenForm "formname,,,."
Case Else
End Select
End Sub
-----------------------------------------------------


thats all

anyway thankx alot my dear
I was helped by you
your points in your way
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now