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.
craigdawsonAsked:
Who is Participating?
 
vikiingConnect With a Mentor Commented:
You have to use KeyPress() event, not KeyDown.

0
 
craigdawsonAuthor Commented:
I tried that without success.  Do you have a snippet of working code?
0
 
vikiingCommented:
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
?K%;
End Sub

0
 
ratsifaCommented:
You may should set the KEYPREVIEW = True for the Form load event.
0
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.