Detect key pressed in Access VBA

  • Thread starter Thread starter Abe Katz
  • Start date Start date
Detect which key was pressed where?

Most Form controls (text box, combo box, etc.) have a KeyPress event that
you can use.
 
Thanks Doug,
I want to use it on a form. When the enter-key is pressed, I want to run an
event.
 
Set the form's KeyPreview property to True, and you can then use the form's
KeyPress event.

Private Sub Form_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then
MsgBox "You hit Enter"
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Event 5
Version of Access is running 1
Check Control if Visible or hidden 1
Outlook 2
List of all Printers 1
Hide System Fileds in table 2
Disable Mouse wheel scrolling 1
Set Function Keys 1

Back
Top