Selecting text with VBA

  • Thread starter Thread starter Wally
  • Start date Start date
W

Wally

Can anyone help me with this little problem? I know it's
simple and I've done something similar before but, I can't
find anything on the subject in Help files or searching
here.

I just need to select all the text in a control on a form
when clicking on it. The control doesn't have tab stop
enabled, but when needed to access, I want the text
automatically selected so user doesn't have to manually do
it. Sorry for the brain lapse but I'm all out of ideas on
how to find this method in help.

Thanks,
Wally
 
Use a combination of the SelStart and the SelLength properties of the
control.


Private Sub CustNAme_Click()
Me.CustNAme.SelStart = 0
Me.CustNAme.SelLength = Len(Me.CustNAme)
End Sub
 
You see! I told you it was simple.
It's all coming back now.
Thanks Sandra
-----Original Message-----
Use a combination of the SelStart and the SelLength properties of the
control.


Private Sub CustNAme_Click()
Me.CustNAme.SelStart = 0
Me.CustNAme.SelLength = Len(Me.CustNAme)
End Sub


--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.

Can anyone help me with this little problem? I know it's
simple and I've done something similar before but, I can't
find anything on the subject in Help files or searching
here.

I just need to select all the text in a control on a form
when clicking on it. The control doesn't have tab stop
enabled, but when needed to access, I want the text
automatically selected so user doesn't have to manually do
it. Sorry for the brain lapse but I'm all out of ideas on
how to find this method in help.

Thanks,
Wally

.
 
You're welcome!

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.

You see! I told you it was simple.
It's all coming back now.
Thanks Sandra
-----Original Message-----
Use a combination of the SelStart and the SelLength properties of the
control.


Private Sub CustNAme_Click()
Me.CustNAme.SelStart = 0
Me.CustNAme.SelLength = Len(Me.CustNAme)
End Sub


--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.

Can anyone help me with this little problem? I know it's
simple and I've done something similar before but, I can't
find anything on the subject in Help files or searching
here.

I just need to select all the text in a control on a form
when clicking on it. The control doesn't have tab stop
enabled, but when needed to access, I want the text
automatically selected so user doesn't have to manually do
it. Sorry for the brain lapse but I'm all out of ideas on
how to find this method in help.

Thanks,
Wally

.
 
Back
Top