Selecting text in a textbox

K

Karen Hagerman

I would like the text in a textbox automatically selected when the textbox gets focus. Any ideas as to how to do this?

Karen
 
A

Allen Browne

Set the option under:
Tools | Options | Keyboard | Behavior entering field

If you want to alter a selection programmatically, see help on SelStart and
SelLength.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.


I would like the text in a textbox automatically selected when the textbox
gets focus. Any ideas as to how to do this?

Karen
 
S

Steve

Put the following code in the OnEnter event of the textbox:

Me!NameOfTextBox.SelLength = Len([Me!NameOfTextBox.Text])

This will highlight all the text in the textbox when you enter the textbox.


--
PC Datasheet
A Resource for Access, Excel and Word Applications
(e-mail address removed)
www.pcdatasheet.com

· Design and basic development for new applications
· Additions, Modifications and "Fixes" for existing applications
· Mentoring for do-it-yourselfers who want guidance
· Complete application design and development
· Applications Using Palm Pilot To Collect Data And
Synchronize The Data Back To Access Or Excel



I would like the text in a textbox automatically selected when the textbox gets
focus. Any ideas as to how to do this?

Karen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top