Thread: Cursor position
View Single Post
  #3  
Old January 11th, 2010, 10:01 PM posted to microsoft.public.access.forms
Al Campagna[_2_]
external usenet poster
 
Posts: 1,462
Default Cursor position

Abe,
There are two situations...
When you Tab into the field, or when you mouse click
into the field. (ex. LastName)
This code covers both...
**For cursor at the Beginning of the text string...
Private Sub LastName_Click()
LastName.SelStart = 0
LastName.SelLength = 0
End Sub
Private Sub LastName_Enter()
LastName.SelStart = 0
LastName.SelLength = 0
End Sub

**For Cursor at End of the text string...
Private Sub LastName_Click()
LastName.SelStart = Len(LastName)
LastName.SelLength = 0
End Sub
Private Sub LastName_Enter()
LastName.SelStart = Len(LastName)
LastName.SelLength = 0
End Sub
--
hth
Al Campagna
Microsoft Access MVP 2006-2009
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

"Abe Katz" wrote in message
...
Hello,
When I tab from one control to another or use docmd.gotoControl the
control gets highlighted automatically.
Is there a way to put the cursor at the end of the control or at the
beginning of the control without highlighting the control?
Thanks
Abe