Select All text

halem2

Registered User.
Local time
Today, 08:35
Joined
Nov 8, 2006
Messages
180
hello World!


Running Access 2000.

I have a form with one text box in it. How can I select all the text in the txt box when the form opens and when I move to next record?

thanks you
 
not really. The txt box is the only control in the form so it has the focus already. What I need is to to have the text inside the txt box all selected, as if you were going to copy it.
 
Once the textbox has the focus the text is surely highlighted. It certainly works with the Ctl+C keywboard stroke.
 
Once the textbox has the focus the text is surely highlighted. It certainly works with the Ctl+C keywboard stroke.

This behaviour depends on the setting under Extra > Options > tab Keyboard: "Behavior Entering Field" (Hope I guessed the menu option right).
This is a user setting and can be controlled in VBA by:
Code:
application.setOption "Behavior Entering Field", 0
 
Thanks guys for the help.

Peter: is the a way to change the behavior to Entire Field in just one control in a specific form, while leaving the Options to Beginning of Field?
 
Sure, an easy way is to put this in the GotFocus event:

Me.YourTextBoxName.SelStart=0
Me.YourTextBoxName.SelLength = Len(Me.YourTextBoxName.Text)
 
That's exactly what I needed.

Thanks to Everyone involved. Bob, as usual, you're right on the money!. thanks :D
 
Bob. Am new to this! Did you mean "put in the OnClick event" not GotFocus?

I can get it to work on the onclick but not gotfocus. Am I missing some point here? I know default action on using Tab to enter a field is to select all the text and this property can be changed [see PeterF - above]. But my problem was to get the whole field/text selected when clicking with a mouse, which your code fixes [using onclick]. Thanks David
 

Users who are viewing this thread

Back
Top Bottom