i have a 3 text box so what i want to do is if the user reach the maxlength that i assign on the text box 1 it must automatically go to text box 2 until it reach to the text box 3 without pressing the tab.
any help will be heavenly appreciated.
Printable View
i have a 3 text box so what i want to do is if the user reach the maxlength that i assign on the text box 1 it must automatically go to text box 2 until it reach to the text box 3 without pressing the tab.
any help will be heavenly appreciated.
If Len(Text1) = Text1.MaxLength Then Text2.SetFocus
You can test the length in the Change event
Edited: Baja_yu got there first.Code:Private Sub Text1_Change()
If Len(Text1.Text) = Text1.MaxLength Then Text2.SetFocus
End Sub
Private Sub Text2_Change()
If Len(Text2.Text) = Text2.MaxLength Then Text3.SetFocus
End Sub
Code:Private Sub Text1_Change()
'max length is 10
If Len(Text1.Text) = 10 Then Text2.SetFocus
End Sub
Private Sub Text2_Change()
'max length is 10
If Len(Text2.Text) = 10 Then Text3.SetFocus
End Sub
Private Sub Text3_Change()
'max length is 10
If Len(Text3.Text) = 10 Then MsgBox "You are done hoss."
End Sub
oh thank you.