From: Dennis on
In Access 2003, I need to be able to highlight (select) a substring of the
text in a textbox for an existing record. For example, if I have a date:

3/10/2009

I might need to highlight the "3/10" part while leaving the "/2009" part
unhighlighted. This would facilitate data-entry of a month/day while leaving
the year as-is. I know this is possible, but have forgotten how. Can someone
please point me in the right direction?

Thanks a million!
From: Tom van Stiphout on
On Wed, 17 Mar 2010 13:05:04 -0700, Dennis
<Dennis(a)discussions.microsoft.com> wrote:

Check the help file on SelStart and SelLength.

-Tom.
Microsoft Access MVP


>In Access 2003, I need to be able to highlight (select) a substring of the
>text in a textbox for an existing record. For example, if I have a date:
>
>3/10/2009
>
>I might need to highlight the "3/10" part while leaving the "/2009" part
>unhighlighted. This would facilitate data-entry of a month/day while leaving
>the year as-is. I know this is possible, but have forgotten how. Can someone
>please point me in the right direction?
>
>Thanks a million!
From: Marshall Barton on
Dennis wrote:

>In Access 2003, I need to be able to highlight (select) a substring of the
>text in a textbox for an existing record. For example, if I have a date:
>
>3/10/2009
>
>I might need to highlight the "3/10" part while leaving the "/2009" part
>unhighlighted. This would facilitate data-entry of a month/day while leaving
>the year as-is. I know this is possible, but have forgotten how. Can someone
>please point me in the right direction?


Use the Enter event:

If Len(Nz(Me.textbox, "")) > 5 Then
Me.textbox.SelStart = 0
Me.textbox.SelLength = Len(Me.textbox) - 5
End If

--
Marsh
MVP [MS Access]