Results 1 to 3 of 3
  1. #1
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Cursor position in a text box (Access 2003)

    I have a challenge where i have to know the position of the cursor in a text box.

    At this point i need to select text from a combo box which i need to insert into the original text box i was editting. The string i need to insert is the text from the combobox surrounded by {} type brackets.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Cursor position in a text box (Access 2003)

    As soon as the user leaves the text box, whether by clicking or by pressing Tab or Enter, Access "forgets" what was selected in the text box. Even in the On Exit and On Lost Focus events, the information is already lost. The only way you can do something with the selection in a text box is through a keyboard shortcut, toolbar button or menu option, since these don't take away the focus from the text box. You can then use the SelStart and SelLength properties of the text box. And the user must invoke these while the text box has the focus.

  3. #3
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Cursor position in a text box (Access 2003)

    I have solved the problem. I saved the SelStart on the following events for the text box:
    Click
    KeyUp

    This is sufficient to save the position of the cursor of the text box control, as far as I know.

Posting Permissions

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