Main Page | Report this Page
Computers Forum Index  »  Computer - Databases - MS Access  »  Convert HTML color code to Access color number ?...
Page 1 of 1    

Convert HTML color code to Access color number ?...

Author Message
Malcolm Hind...
Posted: Fri Oct 23, 2009 9:17 pm
Guest
I have HTML color codes stored in fields - how do I convert
these to accurate Access color codes that can be used to set
background colors to Access Rectangle controls, text color etc.
I know how to change the control properties but I cannot convert
HTML color codes to Access color codes.

Thanks
 
Rich P...
Posted: Fri Oct 23, 2009 9:17 pm
Guest
I searched around for articles on converting hex to RGB numbers, but
found sites that only perform the operation but don't show the source
code for doing this. So I guess it isn't trivial. One thing you could
do is get a table of Hex to RGB values and create your own table within
Access and then --

--
here is the site which has such a table including the associated colors

http://web.njit.edu/~kevin/rgb.txt.html
--

peform the matches yourself. Like 7F00FF is purple(ish) and the
corresponding RGB values are 127;0;255. Then use the RGB function (in
VBA) to apply the selected color.


Rich

*** Sent via Developersdex http://www.developersdex.com ***
 
Roger...
Posted: Fri Oct 23, 2009 9:17 pm
Guest
On Oct 23, 11:47 am, Malcolm Hind <m.hind... at (no spam) NOSPAMbtinternet.com>
wrote:
Quote:
Rich P <rpng... at (no spam) aol.com> wrote in news:4ae1df25$0$1328
$815e3... at (no spam) news.qwest.net:







I searched around for articles on converting hex to RGB
numbers, but
found sites that only perform the operation but don't show
the source
code for doing this.  So I guess it isn't trivial.  One
thing you could
do is get a table of Hex to RGB values and create your own
table within
Access and then --

--
here is the site which has such a table including the
associated colors

http://web.njit.edu/~kevin/rgb.txt.html
--

peform the matches yourself.  Like 7F00FF is purple(ish) and
the
corresponding RGB values are 127;0;255.  Then use the RGB
function (in
VBA) to apply the selected color.

Rich

*** Sent via Developersdexhttp://www.developersdex.com***

Rich, Thanks for the reply.
I did not think that Access could use RGB codes ? The color
codes you see on the property forms are just Long numbers -
can't make any sense of what they represent but when setting
color properties, this is what Access wants !

I need to be able to do this on the fly for any entered HTML
color so I don't think I can go th way of a lookup table.

Thanks- Hide quoted text -

- Show quoted text -

the long integer in access represents rgb() value
so for blue rgb(0,0,255) = 16711680L
and red rgb(255, 0 , 0) = 255L
and green rgb(0, 255,0) = 65280L

and the hex() function will give you back the breakdown of the
individual colors
?hex(16711680)
FF0000

?hex(255)
FF

?hex(65280)
FF00

?cint(&HFF)
255

but I don't know what your html color codes look like
 
Malcolm Hind...
Posted: Fri Oct 23, 2009 9:47 pm
Guest
Rich P <rpng123 at (no spam) aol.com> wrote in news:4ae1df25$0$1328
$815e3792 at (no spam) news.qwest.net:

Quote:
I searched around for articles on converting hex to RGB
numbers, but
found sites that only perform the operation but don't show
the source
code for doing this. So I guess it isn't trivial. One
thing you could
do is get a table of Hex to RGB values and create your own
table within
Access and then --

--
here is the site which has such a table including the
associated colors

http://web.njit.edu/~kevin/rgb.txt.html
--

peform the matches yourself. Like 7F00FF is purple(ish) and
the
corresponding RGB values are 127;0;255. Then use the RGB
function (in
VBA) to apply the selected color.


Rich

*** Sent via Developersdex http://www.developersdex.com ***


Rich, Thanks for the reply.
I did not think that Access could use RGB codes ? The color
codes you see on the property forms are just Long numbers -
can't make any sense of what they represent but when setting
color properties, this is what Access wants !

I need to be able to do this on the fly for any entered HTML
color so I don't think I can go th way of a lookup table.

Thanks
 
Chuck Grimsby...
Posted: Sat Oct 24, 2009 11:02 pm
Guest
On Oct 23, 12:17 pm, Malcolm Hind <m.hind... at (no spam) NOSPAMbtinternet.com>
wrote:
Quote:
I have HTML color codes stored in fields - how do I convert
these to accurate Access color codes that can be used to set
background colors to Access Rectangle controls, text color etc.
I know how to change the control properties but I cannot convert
HTML color codes to Access color codes.

Thanks

Seach for RGB in this newsgroup and you'll find your answer. It was
quite a while ago, but the code works perfectly!
 
 
Page 1 of 1    
All times are GMT
The time now is Fri Dec 04, 2009 3:48 pm