>Hello Guys
>In the Keypressed event of he form (with KeyPreview = True), I check to see if the return key has been pressed then do a Sendkey {TAB} so that when the user presses the enter key on the textbox, focus will be set to the next textbox.
>
>I tried doing the validation in the Keypressed event of the TextBox
>and that seems to work just fine, but I cannot trap for when the user presses
>the Tab key to move to the next textbox.
>
>Is there some way that I can trap for the TAB key being pressed within the form
>or can anyone out there suggest a different approach???
I don't understand that part.
Here is the code to simulate the Tab when the user press Enter:
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
KeyAscii = 0
SendKeys "{TAB}"
End If
End Sub
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com