Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

On Enter Event Procedure

On Enter Event Procedure

On Enter Event Procedure

I've been using the following code in the On Enter Event Procedure to make the cursor go to the end of the text in a text box instead of highlighting it:

Me!txtActionItem.SelStart = Me!txtActionItem.SelLength

Is there another way to have this code apply to the entire form, as opposed to putting it in for each text box?

Linda Adams
Linda Adams Online
I'm a professional writer, published internationally.

RE: On Enter Event Procedure

There is no easy, or pretty way.

One of the options is to create a private function in your form:

Private Sub GoToEnd(strField As String)
   Me(strField).SelStart = Me(strField).SelLength
End Sub

Then on the Got Focus Event of each field you want this to happen to, put the following:

Private Sub City_GotFocus()
    Call GoToEnd("City")
End Sub

Replace the red to the same as the bolded field name:

This will be alot of code, as every text box On Got Focus Event will have Call GoToEnd("FieldName"), but it will work.

Jim Lunde
Custom Application Development

RE: On Enter Event Procedure

  Can't you just go to the Tools/Options/Keyboard Tab and select "Go to End of Field" under "Behavior Entering Field"?  This makes the cursor go to the end of the fields instead of highlighting the complete field.   

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close