Share via

Combo Box Entry Highlighting

Anonymous
2015-04-21T16:04:02+00:00

Hi

When making a selection from a combo box Access automatically highlights the selection and when refreshing the data of a form it does the same for first field of the form.

Can I stop this automatic highlighting happening?

Thanks.

Chris.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

8 answers

Sort by: Most helpful
  1. Anonymous
    2015-04-22T11:51:28+00:00

    Thanks both.

    I'll play around with each idea and see which I prefer.

    Chris

    Was this answer helpful?

    0 comments No comments
  2. ScottGem 68,830 Reputation points Volunteer Moderator
    2015-04-22T11:38:26+00:00

    Add the following function to the form's module:

    Private Function ZeroSelection()

        With Me.ActiveControl

            .SelLength = 0

            .SelStart = 0

        End With

    End Function

    If you want the insertion point to be at the end of the value rather than the start amend the code as follows:

            .SelStart = Len(.Value) + 1

    Then set the On Got Focus event property of each control in which you want to suppress the selection when the control receives focus to:

        =ZeroSelection()

    However, this means that if the user then types a value this will be inserted before/after the existing value and not overwrite it, which is what would normally be wanted.  So rather than the above you might think about setting the BackColor and ForeColor properties of the control to colours which will allow greater legibility.

    PS:  Having read your post again I see that it's when a selection is made that you wish to suppress the selection, not just when the control receives focus.  I don't think there's any event which would allow this, so you'd have to amend the colours to make it more legible.

    Was this answer helpful?

    0 comments No comments
  3. ScottGem 68,830 Reputation points Volunteer Moderator
    2015-04-22T11:38:26+00:00

    I would change your color schemes. its true that white on black doesn't always show up well. You can also use the GotFocus event to chage the fore and back colors.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2015-04-22T09:31:37+00:00

    Hi Scott

    You'll see in the screenshot that once I select an entry from the combo box it highlights itself in black.

    Is it possible to control this highlighting in any way; I understand that it makes sense to always identify whatever is in focus but what I'm getting isn't very legible.

    Many thanks.

    Chris.

    Was this answer helpful?

    0 comments No comments
  5. ScottGem 68,830 Reputation points Volunteer Moderator
    2015-04-21T16:52:31+00:00

    Not sure what you mean by highlighting. A screen shot might help. When a control has focus, the entry in that control will show differently to indicate the control has focus.

    Was this answer helpful?

    0 comments No comments