Solved

Assign keystroke to button on Form

Posted on 2002-04-19
3
370 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
  • 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

831 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