Steve R.
Retired
- Local time
- Today, 09:51
- Joined
- Jul 5, 2006
- Messages
- 5,616
Prior to Access 2007, the property sheet for a control would return the value of a color as a decimal number. With Access 2007, the property sheet now returns the value of a control's color as a hexadecimal number. This created a problem with revising my forms when using VBA code. Through the help of this forum, I was able to develop a solution. So if you are having issues with setting a controls colors, here is one solution.
The hexadecimal number "#D8B190" is displayed when you look at the "BackColor" number for the "Detail" control under the format tab.
Place the code below in a module.
The hexadecimal number "#D8B190" is displayed when you look at the "BackColor" number for the "Detail" control under the format tab.
Code:
Me.Detail.BackColor = HTMLConvert("#D8B190")
Place the code below in a module.
Code:
Public Function HTMLConvert(strHTML As String) As Long
Rem converts a HTML color code number such as #D8B190 to an RGB value.
HTMLConvert = RGB(CInt("&H" & Mid(strHTML, 2, 2)), CInt("&H" & Mid(strHTML, 4, 2)), CInt("&H" & Mid(strHTML, 6, 2)))
End Function
Last edited: