InactiveColor = CLng("&H" & strColor)
This is wrong.
The UDF (user defined function) Hexcolor() is no different that the functions IsNull(), Instr(), or Left(), except it is not built in.
The code Linq posted in #11 takes the Access color number, removed the "#", changes the order of the color bytes (R,G,B), add the prefix "&H", then converts the number to a long.
Usage:
You must add the code to a module!
Then, to set the background color, you can use:
Code:
Me.YourControlName.BackColor = HexColor("#B2A97A")
or
Code:
Dim InactiveColor as Long
InactiveColor= HexColor("#B2A97A")
Me.YourControlName.BackColor = InactiveColor
Another method is:
Code:
Dim InactiveColor as Long
InactiveColor= RGB(178, 169, 122) ' <= from the color picker
Me.YourControlName.BackColor = InactiveColor