Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

On Enter Event Procedure

Status
Not open for further replies.

Garridon

Programmer
Mar 2, 2000
718
US
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: <br><br>Me!txtActionItem.SelStart = Me!txtActionItem.SelLength<br><br>Is there another way to have this code apply to the entire form, as opposed to putting it in for each text box?<br><br><br><br> <p>Linda Adams<br><a href=mailto:Garridon@aol.com>Garridon@aol.com</a><br><a href= Adams Online</a><br>I'm a professional writer, published internationally.
 
There is no easy, or pretty way.<br><br>One of the options is to create a private function in your form:<br><br>==========<br>Private Sub GoToEnd(strField As String)<br>&nbsp;&nbsp;&nbsp;Me(strField).SelStart = Me(strField).SelLength<br>End Sub<br>==========<br><br>Then on the Got Focus Event of each field you want this to happen to, put the following:<br><br>==========<br>Private Sub <b>City</b>_GotFocus()<br>&nbsp;&nbsp;&nbsp;&nbsp;Call GoToEnd(&quot;<font color=red>City</font>&quot;)<br>End Sub<br>==========<br><br>Replace the red to the same as the bolded field name:<br><br>This will be alot of code, as every text box On Got Focus Event will have <b>Call GoToEnd(&quot;FieldName&quot;)</b>, but it will work.<br> <p>Jim Lunde<br><a href=mailto:compugeeks@hotmail.com>compugeeks@hotmail.com</a><br><a href= Application Development
 
Linda,
Can't you just go to the Tools/Options/Keyboard Tab and select &quot;Go to End of Field&quot; under &quot;Behavior Entering Field&quot;? This makes the cursor go to the end of the fields instead of highlighting the complete field.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top