I Don't Want to Select the Whole Field!

AggieLJ

Registered User.
Local time
Yesterday, 19:27
Joined
Jan 9, 2009
Messages
30
Howdy All,

I have two text boxes I am working with: txtStarting and txtEnding. On the AfterUpdate property of txtStarting, I have a command which sends the first three numbers to txtEnding. When you tab from txtStarting to txtEnding, the whole field of txtEnding is highlighted, and I would rather the cursor go to the end so that I can type without having to deselect everything else first.

Any ideas on how to make the cursor go to the end of the field instead of selecting the whole thing?

Thanks in advance!
 
Look at the SelStart and SelLength properties in VBA help.
 
That worked great!

I ended up doing:

Code:
Private Sub txtStarting_AfterUpdate()

     Me.txtEnding = Left(Me.txtStarting, 3)          'Copies the first three digits to Me.txtEnding
     Me.txtEnding.SetFocus                           'Sets focus to Me.txtEnding
     Me.txtEnding.SelStart = Me.txtEnding.SelLength  'Moves the Cursor to the end of Me.txtEnding

End Sub
Thank you for the fantastic help!
 

Users who are viewing this thread

Back
Top Bottom