How to trap TAB keystroke

How do I trap the TAb keystroke?  The KeyDown event doesn't recognize vbKeyTab and KeyPress doesn't recognize KeyAscii = 9.
Who is Participating?
vikiingConnect With a Mentor Commented:
You have to use KeyPress() event, not KeyDown.

craigdawsonAuthor Commented:
I tried that without success.  Do you have a snippet of working code?
This silly code will put at screen ASCII codes of the keys you type. And you can see the 9 for the TAB key:

Private Sub Form_KeyPress(K%)
Form1.Visible = True
Form1.AutoRedraw = True
End Sub

You may should set the KEYPREVIEW = True for the Form load event.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.