Move to next field from full text box

B

Bill Parker

I have lurked here for years and gained valuable skills, many thanks.
However, I have a need to be able to go to the next text box in a data entry
screen when the first text box is full, without having to hit enter. I saw
the post about doing it with a combo box (Me.[TextBoxName].SetFocus), but I
can't get it to work by just filling the field. It may not be possible in
Access, but if you know how, please come forth.

Best regards
 
M

missinglinq via AccessMonster.com

The control's AutoTab property (set to Yes) is what you're thinking of, but
if I remember correctly it only work's if you have an Input Mask set for the
control that limits the maximum number of characters that can be entered.

Bill said:
I have lurked here for years and gained valuable skills, many thanks.
However, I have a need to be able to go to the next text box in a data entry
screen when the first text box is full, without having to hit enter. I saw
the post about doing it with a combo box (Me.[TextBoxName].SetFocus), but I
can't get it to work by just filling the field. It may not be possible in
Access, but if you know how, please come forth.

Best regards
 
M

missinglinq via AccessMonster.com

I figured out a workaround without having to use an Input Mask; I personally
hate them!

Private Sub YourTextBoxName_Change()
If Len(Me.YourTextBoxName.Text) = X Then NameOfNextControl.SetFocus
End Sub

Where X is the number of characters allowed in the textbox and
NameOfNextControl is the name of the control you want to receive focus next.
 
B

Bill Parker

Thanks very much, that worked a treat! I tried the LEN() approach, but with
key stroke, not change; I didn't think of delaying the "on change" through
the If statement. You Rock!
 
Top