简体   繁体   中英

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?

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

Me.Repaint

and set BackStyle to Normal.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM