A family of Microsoft relational database management systems designed for ease of use.
Thanks both.
I'll play around with each idea and see which I prefer.
Chris
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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.
A family of Microsoft relational database management systems designed for ease of use.
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.
Thanks both.
I'll play around with each idea and see which I prefer.
Chris
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.
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.
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.
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.