Hello, I am asking for help with getting my TextBoxes and ComboBoxes change to a different Backcolor on GotFocus and change back to its original Backcolor on LostFocus. Maybe a global routine to set these, or do this when the form opens / loads. I am getting this done now by coding the gotFocus and LostFocus Events for each control, but it is very time consuming when you have many controls on the form and also have many forms. Any help would be greatly appreciated and thanks in advance for your help.
Donald pointed you to the right feature, Rupert. In Design View, select your text boxes and combo boxes, go to Format > Conditional Formatting, and add a Field Has Focus rule with the background color you want. When you tab or click out of the control, the highlight goes away. No Got Focus or Lost Focus code needed for that.
You can apply the rule to several controls at once if they don't already have rules you want to keep. If a control already has conditional formatting, add the focus rule to that control separately. My Conditional Formatting video shows both setups, including how to give the focus rule priority.
Rupert BennettOP
@Reply 3 days ago
Saying thank you is not enough to express my gratitude for your assistance. This works perfectly and is much easier than VBA coding. Thank you.
You're very welcome, Rupert. Glad that did the trick! Conditional Formatting is one of those little Access features that can save you a lot of repetitive VBA. Plus, it works in continuous forms, so you can have different controls showing different colors and such. That's not nearly as easy to do with VBA events like it is on a single form.
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.