Back colours on a report

B

Box666

I have a report that will colour certain boxes depending on its content
(code below). I have now been asked to add 2 more colours to the scheme
( I already use Green, red, blue, white and yellow. I did try to use
grey but that comes out as black and as such does not look very
attractive on the report.)
Could somebody please advise me of any other colours available and how
I would then code them in to the program below. ( I would have thought
that most shades would be available as I see Access gives "code
numbers" to all colours when used on say a form, but I do not know how
to translate that into what i gues is VB code.)

with thanks

Bob



Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Jan = "Excd" Then
Box146.BackColor = vbGreen
ElseIf Jan = "Miss" Then
Box146.BackColor = vbRed
ElseIf Jan = "Met" Then
Box146.BackColor = vbBlue
ElseIf Jan = "New" Then
Box146.BackColor = vbYellow
ElseIf Jan = "N.L.R." Then
Box146.BackColor = vbYellow
ElseIf Jan = "HO" Then
Box146.BackColor = vbgrey
ElseIf Jan = "HB" Then
Box146.BackColor = vbgrey
Else: Box146.BackColor = vbWhite
 
R

Rick Brandt

Box666 said:
I have a report that will colour certain boxes depending on its
content (code below). I have now been asked to add 2 more colours to
the scheme ( I already use Green, red, blue, white and yellow. I did
try to use grey but that comes out as black and as such does not look
very attractive on the report.)
Could somebody please advise me of any other colours available and how
I would then code them in to the program below. ( I would have thought
that most shades would be available as I see Access gives "code
numbers" to all colours when used on say a form, but I do not know how
to translate that into what i gues is VB code.)

Open a dummy form in design view then select the detail section and on the Back
Color property of the property sheet press the builder button [...]. This will
bring up the color chooser dialog.

On that dialog you have 64 base colors to choose from and you can press the
[Define Custom Colors] button that will open another dialog where you have
virtually millions of colors you can choose from.

Any selection you make will be placed into the Back Color property as a numeric
value which you can use in your code. They only assigned vb constant names to a
small number of common colors, but the numeric entries allow you to have just
about any color imaginable.
 
F

freakazeud

Hi,
use the RGB() function to provide the exact color values...the syntax of the
RGB() function is:

RGB(Red As Integer, Green As Integer, Blue As Integer) As Long

HTH
Good luck
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top