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
 
Back
Top