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!

Don't want to Access to select all text when I tab into a text box 3

Status
Not open for further replies.

Ymesei

MIS
Jul 25, 2000
44
GU
Does anyone know how to prevent Access from selecting all the text in a text box when you tab to it in a form? I want a user to be able to tab (or press enter) to get the focus on a text box, but have the cursor at the end of the existing text in the control rather than highlighting the entire text.

I know you can just press F2 once the text box has the focus, but the fewer the keystrokes the better.

Thanks in advance.

Will

"Never laugh at ignorance. You may not know what your laughing at."
 
Ken,

Thanks for the tip. I knew that was a setting I could change somewhere. Now, can I leave that as the default, but have only one particular field in a form act differently.

Is this something that I could set on the properties of only one control and not have it be a global setting for my app?

Thanks again.

Will

"Never laugh at ignorance. You may not know what your laughing at."
 
hi

uhmm.. have not done that before, I think there are properties of a text box control somethink like .selstart, .sellength that may do that good luck

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Ymesei,

KenReay has the right idea. To control insertion point on a single textbox you need to use the following code:

Where "TextBoxName" is the name of your text box

To insert at the end of the text in the box:

Private Sub TextBoxName_Enter()
TextBoxName.SelStart = X
End Sub

Where "X" is an integer that is greater than the maximum length of the field for the text box.


To insert at the beginning of the text in the box:

Private Sub TextBoxName_Enter()
TextBoxName.SelStart = 0
End Sub


To select all the text in the box:

Private Sub TextBoxName_Enter()
TextBoxName.SelLength = X
End Sub

Where "X" is an integer that is equal to the maximum length of the field for the text box.

Hope this helps.

The Missinglinq



"It's got to be the going,
not the getting there that's good!"
-Harry Chapin
 
Linq/Ken,

Thanks for the help. That worked like a charm.

A star for each of you!!

Thanks,

Will

"Never laugh at ignorance. You may not know what your laughing at."
 
Missingling:

Thanks. I spent about an hour trying to figure this out before I thought to check here.

Your post was just what I needed.

Larry De Laruelle

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top