Results 1 to 6 of 6
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington, Cheshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts
    When Tab is used to move about a form, entering a control causes all the contents of the control to be selected/highlighted. When entering a control by clicking the mouse, only the cursor moves into the selected control.

    Is there a way to select/highlight the control contents when mouse clicking i.e. the same way that tabbing into a control does, please?
    Thanks
    Silverback
    Silverback

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Why in heaven's name would you want to do that? It would irritate me no end if I weren't able to position the insertion point by clicking at the desired position!

    There is no general setting that controls this, so you'd have to create code in the On Click event for every control on every form where you want the contents to be selected - not a very attractive idea!

    For a text box named txtAddress the code would look like this:

    Code:
    Private Sub txtAddress_Click()
      With Me.txtAddress
    	.SelStart = 0
    	.SelLength = Len(.Text)
      End With
    End Sub
    Note: it doesn't work if you use the On Got Focus event or On Enter event, so you have to use the On Click event...

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington, Cheshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oh dear; didn't mean to cause irritation! I'll do what I should have done in the first place and describe the problem I'm trying to solve instead of asking about a specific implementation issue.

    I am trying to solve (the apparently perennial) question of positively identifying which is the active row in a sub form.

    The sample Northwind DB contains a form - Customer Orders - which, when the user clicks anywhere in an order record in Subform1, displays the order details for that order in Subform2. This is exactly the mechanism I need for my two subforms.

    Northwind DB displays its data in datasheet mode; in this mode, no matter which field in a row is clicked, the active row (in both subform1 and subform2) is indicated by the triangle/arrowhead in the leftmost column. My user wants the subforms displayed in Continuous Forms mode; as far as I know, this means that apart from a flashing line (=cursor) in any one of many controls in the record, there is no clear indication of which is the active row, and thus it's easy to get confused about which row in subform1 is driving the data display in subform2. It's frustrating that Access sorts this problem out for users in datasheet mode but omits a mechanism to do the same for Continuous Forms mode.

    So I came up with the idea of selecting the contents of whatever control the user clicked in so they had a positive indication of which row in subform1 was driving the display of subform2. I can see that selecting the contents of control is not ideal - but I'm just trying to let the user know which is the active row. I haven't found an obvious solution to this problem searching the lounge - although it seems there are quite a few loungers who'd welcome this facility.

    Is there a better design solution to to this problem please?
    Thanks
    Silverback
    Silverback

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    That's easy:

    - Open the subform in design view.
    - Activate the Format tab of the Properties window.
    - Set the Record Selectors property to Yes.
    - Save and close the subform.

    The subform will now display gray "buttons" to the left of each record in single or continuous form view, with a triangle in the active one, or a pencil if the record is being edited.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    It is also possible to highlight the current record - see the attachment to Post 382292.

    And you can use Format | Conditional Formatting to make Access apply special formatting to a control if it has the focus.

  6. #6
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington, Cheshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oh how simple is that.
    Thanks for this and the other posting.
    Off to get that new brain, now.
    Silverback
    Silverback

Posting Permissions

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