Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need lighter gray color when printing alternating shading in reports

Status
Not open for further replies.

MikeFL

Programmer
Jul 12, 2002
58
US
I’m presently using Const XorToggle = 4144959 and it’s too dark according to the end users. Is there a chart showing all the color numbers I can use?

 
The colour numbers are actually derived from the RGB colour system which you can see inn Visual Basic etc. Access displays them as decimal numbers, hiding their origins (!)

Think of the three primary colours - Red, Green and Blue - as having faders or 'volume controls' which can be set to any number from 0 (no colour) to 255 (brightest colour).

The colour numbers which you see in Access come from this formula:

RedValue + (Green Value * 256) + (BlueValue * 256 * 256)

The good news (?) is that there's an easy way to convert a colour which you choose visually, into a colour number. You can do this in Access, by creating e.g. a text box on a test form, or via a Windows program such as Paint.

In Access:
-- Choose the 'BackColor' property of your text box, and click the [...] ellipsis buton alongside.
-- Click the [Define Custom Colours] button.
-- Choose the colour you want by dragging the mouse round the colour box.
-- 'Fine tune' the colour by changing the values of the individual red, green and blue numbers.
-- When your colour is OK, click the [Add to custom colours] button.
-- Make the backcolor of your text box this custom colour.

You now have the 'colour number' you require, shown in the BackColor property of the text box.

You can use Paint in a similar way, but here you will need to write down the red, green and blue numbers, then multiply as shown earlier to get the number.

You can also change object colours programmatically, using the RGB command:
Code:
Private Sub txtDemo_Click()
    txtDemo.BackColor = RGB(255, 255, 0)
End Sub
In this example, when you click txtDemo, its back colour changes to bright yellow (red + green).

I hope these notes will help you to choose the new colour which you require.

Bob Stubbs (London, UK)
 
Generally, "lighter grey" is easy enough. Using the approach outlined by Mr. Stubbs above, take any shade of grey and reduce the RGB contriobutions equally ubntil you get what you want.

You can find routines here in Tek-Tips (search) to show you how to decode/decompose the Ms. colors into their RGB components, but that is just for those who would actiually like to know what is going on. For the rest, the shades of grey range from White to Black (0, 0, 0) to (255, 255, 255) and remain in the monochrome mode as long as the RGB values are equal.




MichaelRed


 
Michael Red & Bob Stubbs:

Thanks for your help so fare, but I’m still having problems getting the color light enough. When I tried either one of your suggestions on a blank form “back color” changes the color looks just fine, but when I try to use those numbers in my report VB code from:

Const XorToggle = 4144959
Me.Detail.BackColor = Me.Detail.BackColor Xor XorToggle

To this new number:

Const XorToggle = 14145495
Me.Detail.BackColor = Me.Detail.BackColor Xor XorToggle

The color changes come out wrong (very dark)! Is there something I’m doing wrong, the first numbers I used are seven (7) digits long and the second numbers I generated and tried to used are eight (8) digits long. I even tried to cut off the first digit on the generated number making it 4145495, and it turn out to be a light green! Or is it because the color numbers are being generated using a form and then trying to use them in a report VB code?
 
I am not sure why you are using the Xor operator. The effect of this is to change the existing colour by a specific amount (I think?)

Why not just choose a colour you like, then set the BackColor directly, i.e.
Code:
Me.Detail.BackColor = 1234567

or

Me.Detail.BackColor = RGB(100, 100, 100)
etc.

Bob Stubbs (London, UK)
 
hmmmmmmmmmmmmmmmmmmm ... mmmmmmmmmmmmmmm

The XOR 'trick' is found here (in the Tek-Tips). I didn't notice that you were using it on the first pass, as I was just amplyifing Mr. Stubbs post a bit.

The value you found is incorrect. Start with
? rgb(128, 128, 128)
8421504


If this is still to dark, get another value by decreasing the RGB value by some amount to get another color. I would suggest an increment/decrement of sixteen until your audience says it is o.k.

p.s. rgb is a standard VB(A) function.




MichaelRed


 
Bob Stubbs & Michael Red

Thanks for your help on my printing question. I’ve tried all the recommendations and the end users are pleased!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top