VB Code:
'1) If textboxes are in tabindex order
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
'Note that the sub now has an Index As integer item. This
'is the index number of each box u created so u can know
'which one the user is in.
If KeyAscii = 13 Then 'Check for the enter key (13)
KeyAscii = 0 'Reset it to stop beeping
SendKeys "{tab}" 'Tab to next control
End If
End Sub
VB Code:
'2) Tabbing between controls based on index numbers
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then'Check for enter key
KeyAscii = 0 'Reset for beeping
If Index < Text1.UBound Then 'If not last textbox
Text1(Index + 1).SetFocus 'send focus to next item
Else 'if last control send focus back to first item
Text1(Text1.LBound).SetFocus
End If
End If
End Sub