Solved

Assign keystroke to button on Form

Posted on 2002-04-19
3
372 Views
Last Modified: 2006-11-17
Can you show me how to assign a keystroke to a button on a Form.

I have a Form with a command button that checks the data on the Form and then moves to the next record if check is OK.

I want to assign the key F5 (for instance) to carry out the command button's function, ie if the user presses F5 then the data should be checked and move to the next record.

Thanks.
0
Comment
Question by:naqayya
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 44

Accepted Solution

by:
bruintje earned 100 total points
ID: 6953116
Hi nagayya,

You could do something like

if your buttonclick code is something like

Private Sub Command0_DblClick(Cancel As Integer)
  MsgBox "hello!"
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyF5 Then ' call the buttonclick code
    Call Command0_DblClick
  End If
end sub

HTH:O)Bruintje
0
 

Author Comment

by:naqayya
ID: 6953251
Great! But have to set Key Preview to 'Yes'

Thanks!
0
 
LVL 44

Expert Comment

by:bruintje
ID: 6953275
yeah sorry forgot to add that

thanks for the grade
:O)Bruintje
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

738 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