Full Version: What color are these
UtterAccess Forums > Microsoft® Access > Access Forms
Bob G
I had this request from the people I am developing their DB. I tried the rgb(66,99,00) which gave me a color. but the same for rgb(00,33,cc) gave me an error.
quot;the database should be green & blue (pantone 660/RGB 0033cc and pantone 377/RGB 669900"
Any help would be appreciated. Not sure yet where they want which color.
Doug Steele
The values you've got (33, 66, 99, 00 and CC) are all Hex values, while the RGB function expects decimal values. The equivalents are:
Hex  Dec
00   00
33   51
66  102
99  153
CC  204

That means that rather than RGB(66,99,00), you should be using RGB(102,153,0), and rather than RGB(00, 33, CC), you should be using RGB(0, 51, 204)
To convert from Hex to Decimal, you can use CLng("&H00"), CLng("&H33"), CLng("&H66"), CLng("&H99"), CLng("&HCC")
Bob G
Thanks Doug I will give it a go.
Bob and/or Doug,
There are these colors going? Is this for the Detail section? Just trying to learn so more. Thanks!!!
Doug Steele
Doesn't really matter. RGB returns a number that can be plugged into any property that specifies a colour.
Bob G
Here is what I am using them for in this DB. In another one, I have a series of labels / buttons and on the mouseover section I change the font to bold and the color to red so that if the user moves away he knew where he was.
Current DB..
Me.Detail.BackColor = RGB(102, 153, 0)
combomain.ForeColor = RGB(102, 153, 0)
Me.sublibrary1.Form.DatasheetForeColor = RGB(0, 51, 204)

Other DB...
buttonx.FontBold = True
buttonx.ForeColor = RGB(255, 0, 0)

In a REPORT I can enter the following for a Back Color of Red...
e.Detail.BackColor = vbRed
Would this work in a Form too? Of course, give me a second and I will find out.
Never mind, it was a stupid question!!!
Hiya Bob, you might find one of these little gizmos handy for color stuff: Color Picker or this Color Combination Viewer
Bob G
Wow. Thanks. Sure beats plugging in a number and seeing how close it is to what i want
I will experiment with those in the future.
Hi Bob,
And just to add to what Doug was saying, you can also have Access do the Hex conversion for you. For example, you can use:
RGB(&H66, &H99, &H00)
RGB(&H00, &H33, &HCC)
Just my 2 cents...
Bob G
It would do it if i actually could spot the difference between hex or hexnot <
You know the old saying.... The system can do it all, it is just whether you can make it
Also, you can go to the native Access color picker and when you open up Define Custom Colors, you can select the color from the range and it will give you RGB codes for that color. If you haven't used the color picker, just click the [...] by a Background or Fore color property <
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.