How to jump to the next text box ?

  • Thread starter Thread starter javiernews via AccessMonster.com
  • Start date Start date
J

javiernews via AccessMonster.com

Hi,

I have the following scenario:
I have several text boxes in each text box must be filled up to 5 characters
(letters and numbers)
How to jump to the next text box automatically after filling the 5 characters
??????

I try with the following code but is not working well:

Private Sub txt1_Change()
On Error Resume Next
Me.Refresh

Me.txt1.SelStart = Me.txt1 - 1

If Len(Me.txt1) >= 5 Then
Me.txt2.SetFocus
End If

End Sub

Me.txt1 <<<< First Text box
Me.txt2 <<<< Second text box
etc......


any help will be wellcome !
 
Hi,

I have the following scenario:
I have several text boxes in each text box must be filled up to 5 characters
(letters and numbers)
How to jump to the next text box automatically after filling the 5 characters
??????

I try with the following code but is not working well:

Private Sub txt1_Change()
On Error Resume Next
Me.Refresh

Me.txt1.SelStart = Me.txt1 - 1

If Len(Me.txt1) >= 5 Then
Me.txt2.SetFocus
End If

End Sub

Me.txt1 <<<< First Text box
Me.txt2 <<<< Second text box
etc......

any help will be wellcome !


The textbox's value is not yet updated, so refereing to " If
Len(Me.txt1) >= 5 Then " will not reflect the current un-updated
value. Try revising to

Private Sub txt1_Change()
On Error Resume Next

'Setting the SelStart would likely scewup while
'some one is typing. Either way, if txt1's value
'is not a number then subtracting one would likely fail.
'Me.txt1.SelStart = Me.txt1 - 1

If Len(Me.txt1.Txt) >= 5 Then
Me.txt2.SetFocus
End If

End Sub
 
Thank you for your sugestions,.........
but is Not working either !!!

I need to fill the text box with 5 characters (numbers or / and letters)

Any help ?
 
Hi,

I have the following scenario:
I have several text boxes in each text box must be filled up to 5 characters
(letters and numbers)
How to jump to the next text box automatically after filling the 5 characters
??????

If the length of the field to which the textbox is bound is in fact 5, you can
set the textbox's AutoTab property to Yes. It will jump to the next control in
the tab order after the fifth character is typed.

John W. Vinson [MVP]
 
Ok thank you John ,....... But in this case I need to use and Input mask
isn't it ?

Input Mask = CCCCC

But How to make without Input Mask ?????
 
I need to fill the text box with 5 characters (numbers or / and letters)

Exactly five?

Or "five or fewer"?

It makes a big difference!

John W. Vinson [MVP]
 
Ok thank you John ,....... But in this case I need to use and Input mask
isn't it ?

No. The input mask and the AutoSkip are independent of one another.

John W. Vinson [MVP]
 
Ok I found the solution with code:

If I use Len(Me.txt1) it does Not work,.........
but if i use Len(Me.txt1.Text) then it works perfectly !
(No need Auto Tab to Yes or any Input Mask)

Private Sub txt1_Change()
On Error Resume Next

If Len(Me.txt1.Text) >= 5 Then
Me.txt2.SetFocus
End If

End Sub
 
Back
Top