View Full Version : Coloring Controls made easy. Using Intellisence!


thechazm
01-12-2012, 06:20 PM
So long story short I was pissed off at how access does not let you assign colors to controls in vba without a lot of hassle. So I decided to write a class module that has all the value's in it and make it so I could have a nice intellisence experiance anytime I need to change the color of a control.

This is completly free and I hope it helps all the developers out there and relieve some stress. I am happier now!

Code usage:
Just import the class module into your access database.

Then here is all the code you need to make it work.

In any module at the top put this code:

Public ColorControl as new [Color List]


Then in any form or module you can use it like this:

Private Sub Form_Load()
' In this form I have a label that I want to color. The label name is "lblFirst".
me.lblFirst.BackStyle = 1
me.lblFirst.BackColor = ColorControl.Access_Theme_1
End Sub


And on the main forms exit make sure to put the cleanup code:

set ColorControl = nothing


And thats it. Now that is way way way more simple to do then doing debug.print everytime you want to match a color.

As a final note I have added 570 colors that you can pick from. You are welcome to add more if you would like.

Attached here is the Class module and enjoy!!!

40397

Later,

TheChazm

Edit 1: This also works on forms.