• setfocus without selection (97 NL)

    Author
    Topic
    #406054

    Hello all,

    If I set the focus on a form to an other field, Access will select the contents of that field.
    Is it possible to automaticaly deselect the contents and just put the cursor at the end of the text?

    Thanks in advance for your answer.

    Viewing 1 reply thread
    Author
    Replies
    • #839104

      If you would like this as a general setting, select “Go to end of field” in the “Behavior entering field” section of the Keyboard tab of Tools | Options… This is a user-level setting.

      For an individual case, use code like this:

      With Me.ControlName
      	.SetFocus
      	.SelLength = 0
      	.SelStart = Len(.Text)
      End With
      

      where ControlName is the name of the control you want to set focus to (it must be a text box or combo box.)

    • #839105

      If you would like this as a general setting, select “Go to end of field” in the “Behavior entering field” section of the Keyboard tab of Tools | Options… This is a user-level setting.

      For an individual case, use code like this:

      With Me.ControlName
      	.SetFocus
      	.SelLength = 0
      	.SelStart = Len(.Text)
      End With
      

      where ControlName is the name of the control you want to set focus to (it must be a text box or combo box.)

    Viewing 1 reply thread
    Reply To: setfocus without selection (97 NL)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: