Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Almost there 2

Status
Not open for further replies.
Jul 7, 1999
101
US
I'm trying to set up the enter key to move the cursor to text2 when pressed (read on )I think I've tried every combo except the right one.. text1 as follows
Private Sub Text1_Keypress(keyascii as Integer)
dim strvalid as string
strvalid = "01234567890"
If InStr(strvalid, Chr(keyAcsii)) = 0 then
KeyAscii = 0
end if
............ This part works just fine.....
Thanks and Merry Christmas
 
Set keypreview of the form to true

Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
SendKeys "{TAB}"
KeyAscii = 0
End If
End Sub

David Paulson


 
How about:

Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then ' check for CR
KeyAscii = 9 ' change to tab
End If
End Sub


Simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top