Selecting text in a textbox

  • Thread starter Thread starter Karen Hagerman
  • Start date Start date
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
 
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
 
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
 
Back
Top