Link to home
Start Free TrialLog in
Avatar of SteveL13
SteveL13Flag for United States of America

asked on

Set focus on next field when character count = 5

Is there a way to make a form focus on the text field automatically when the user has entered 5 characters in the previous field?
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SteveL13

ASKER

Getting syntax error on...

sendkeys "{TAB}"

Here's my code:

Private Sub txtHNWRNUM_Change()
    If Len(Me.txtHNWRNUM.Text) = 5 Then
        sendkeys "{TAB}"
    End If
End Sub
check if you have MISSING reference.
the word "sendkeys" should change to  SendKeys
No missing reference.

Code now:

Private Sub txtHNWRNUM_Change()
    If Len(Me.txtHNWRNUM.Text) = 5 Then
        SendKeys "{TAB}"
    End If
End Sub
is it working?
Sorry.  No.  Still syntax error when I compile and the line, SendKeys "{TAB}", is red.
there is something wrong with your db.
try creating a new blank db
create a form and place two textbox.
place the code in the first textbox and test
You are not going to believe this one.  I had originally copy/pasted the code you send.  The SendKeys "{TAB}" was red.  I re-typed that line and it works perfectly.  Thank you.
Perfect!  Thank you.