CurtisD
CurtisD

Reputation: 173

Access 2007 - How Do You Use VBA to Change Combobox Backcolor

I want to change the BackColor of a combox box on a form using VBA. I use this code:

Me.Combo1.BackColor=vbYellow

But the backcolor doesn't change. I then put DoEvents after the above line but that didn't help. Combo1.BackStyle is set to Normal. I noticed, however, that if I minimize the form and then restore it the backcolor changes to yellow.

Do I need to set the focus to a different control to make the change in backcolor take place?

Upvotes: 1

Views: 474

Answers (1)

Gustav
Gustav

Reputation: 56026

You may have to repaint the form after the colour change:

Me.Repaint

and set BackStyle to Normal.

Upvotes: 1

Related Questions