Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2004
    Location
    Raleigh, NC
    Posts
    146

    Unanswered: Location within a text box

    Is there a way to control cursor location when you click within a text box? For instance, I have a text box that a phone number is entered into. The text box has the following input mask: !\(999") "000\-0000. The problem is, if you clikc in the center of the box, the cursor is located in the middle of the phone number, not at the beginning. This is bothersome because you then have to either hit "Home" on the keyboard or click at the front of the number. Is there a way to make the cursor jump to the front of the phone number when you click within the text box?

  2. #2
    Join Date
    Mar 2004
    Location
    belgium
    Posts
    290
    Not an elegant solution : set focus to anotherfield and setfocus tot the acquired field

    Private Sub phone_Click()
    Me!ph.SetFocus
    Me!phone.SetFocus
    End Sub

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    You can use the SendKeys

    SendKeys "%{F2}" to edit the field
    SendKeys "{HOME}" to go to the first cell in the TextBox

  4. #4
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Try to play with the SelLength
    SelStart properties

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •