Home  |   French  |   About  |   Search  | mvps.org  

What's New
Table Of Contents
Credits
Netiquette
10 Commandments 
Bugs
Tables
Queries
Forms
Reports
Modules
APIs
Strings
Date/Time
General
Downloads
Resources
Search
Feedback
mvps.org

In Memoriam

Terms of Use


VB Petition

Forms: Move cursor to the end of text in a textbox

Author(s)
Terry Wickenden

(Q)    When I enter a textbox on the form, Access automatically selects all the text in that control. How do I automatically place the cursor at the end of the text that's present there?

(A)    Use the SelStart property of the control. For example, the following code

'******** Code Start **********
' This code was originally written by Terry Wickenden.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Terry Wickenden
'
Private Sub Description_Enter()
    me!Description.SelStart = me!Description.SelLength
End Sub
'******** Code End **********

    placed behind the OnEnter Event of a control called Description on a form ensures that when the control is activated, the cursor will automatically be placed at the end of all the text present in the textbox.


1998-2010, Dev Ashish & Arvin Meyer, All rights reserved. Optimized for Microsoft Internet Explorer