Solved

Assign keystroke to button on Form

Posted on 2002-04-19
3
366 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
Comment Utility
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
Comment Utility
Great! But have to set Key Preview to 'Yes'

Thanks!
0
 
LVL 44

Expert Comment

by:bruintje
Comment Utility
yeah sorry forgot to add that

thanks for the grade
:O)Bruintje
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

771 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

10 Experts available now in Live!

Get 1:1 Help Now