• Automatically select field on click

    Author
    Topic
    #356658

    Access 97 – When the user tabs into a field, the field contents are selected, making it easy to overtype. When you use the mouse to enter the field, field contents are not selected (without dragging). Is it possible to get the mouse-click to select as the tab does?

    Viewing 0 reply threads
    Author
    Replies
    • #528243

      From the main database window, go to Tools|Options… then select the Keyboard tab. An option group will appear at the top right. You can select the way you want Access to behave when entering each field. I have attached a screen shot of the dialog box.

      • #528248

        If you’d rather not make a global change, via code you can set the SelStart property of the control upon entering it. For instance, upon entering a field, set the SelStart = 0, and the cursor starts blinking at position 0.

        • #528255

          My problem is when using the MOUSE, I want the field to be selected upon clicking into it. Is that possible?

          • #528261

            You could use the OnClick event of the textbox. Something like this:

            Private Sub txtYourField_Click()
                 If Not IsNull(txtYourField.Value) Then
                    txtYourField.SelStart = 0
                    txtYourField.SelLength = Len(txtYourField.Value)
                End If
            End Sub

            This is a little tricky because you can’t use the mouse to select part of the field to edit after this is implemented.

            HTH thumbup

            • #528282

              Thank you all. These should get the job done! I’m delighted to be introduced to the Sel group of commands that are new to me.

    Viewing 0 reply threads
    Reply To: Automatically select field on click

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

    Your information: