Solved

Assign keystroke to button on Form

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

821 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