Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Edit a textbox from far left
Jerry Fowler 
       
4 years ago
Took me a while but when I couldn't find it online I just started "Trying for myself" lol.  I want to start editing a date field from the far left when I clicked on it. Instead of clicking then moving to the far left.

Me.controlname.SelStart = 0

Now what I could use help on would be couild I make that a defauly for every textbox on a form?

I tried Me.Ctrl.Name.SelStart = 0
           or
    Dim ctrl As Control
    Dim fieldname As String
    fieldname = ctrl.Name
    Me.fieldname.SelStart = 0

and got nowhere.
Jerry Fowler OP  @Reply  
       
4 years ago
Sorry I meant to add that I put this under form event current and load but neither did anything
Kevin Robertson  @Reply  
          
4 years ago
You would need a Click event for each Text Box on your for that you wanted to run the code.
Also, if it is the current form you don't need the Me.
Example: FirstName.SelStart = 0
Scott Axton  @Reply  
        
4 years ago
This doesn't work if you click in a field, but there is a setting when tabbing (or using enter) to move through fields.

File -> Options -> Client Settings
Scott Axton  @Reply  
        
4 years ago

Maggie M  @Reply  
     
4 years ago
Try the following in the code area for the form:
(Note: If you put this code in a GlobalMod and change Private to Public, you can call it for every form.)
Private Sub SelectText(ctrl As Control)
  With ctrl
    .SelStart = 0
    .SelLength = Len(.Text)
  End With
End Sub
Now call this sub from each click event of your text boxes, sending it the name of the text box.
Hope this helps.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 10:19:50 PM. PLT: 1s