close

Hi,

I was wondering if there was a way to automatically change to a different
text box after entering only one number. I know if you have multiple text
boxes then you can enter info and then hit tab to switch to the next box.
What I want to do is only enter one number into a text box and then have it
move on to the next box.

Thanks so much for any help.

Larry

Hi Larry,

Try something like this:

Private Sub TextBox1_Change()
TextBox2.SetFocus
End Sub

For any change to the text in textbox1, textbox2 gets the focus.Thanks so much for your reply and help. I just have one more question. That
worked beautifully, but what if I wanted to enter 2 numbers into the textbox?

Thanks so much!

quot;Anitaquot; wrote:

gt; Hi Larry,
gt;
gt; Try something like this:
gt;
gt; Private Sub TextBox1_Change()
gt; TextBox2.SetFocus
gt; End Sub
gt;
gt; For any change to the text in textbox1, textbox2 gets the focus.
gt;
gt;

You can trigger it to switch after whatever number of numbers have been
typed in, for example:

Private Sub TextBox1_Change()
If Me.TextBox1.TextLength = 1 Then Exit Sub
If Me.TextBox1.TextLength = 2 Then Me.TextBox2.SetFocus
End Sub

Will switch after two numbers have been typed in. You can use this
logic to set it to whatever number you want by setting the TextLength =
?

Anita

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()