Change BackColor Code Not Working - HELP!

B

Ben

I have a major request for the Dept of Justice. I have a report that looks
like this:

Task Type 4/5/2010 4/12/2010 4/19/2010
DSR St. Louis St. Louis
Exch RU Seatttle
Exch RU Memphis Memphis Memphis

What I need is code that will work. Basically if Task Type = DSR then the
background color of St. Louis and all other sites with "DSR" attached to it
should be Red. If the Task Type is Exch RU then it'll be Blue, etc.

Please respond quickly.

Thanks
 
D

Duane Hookom

Your report looks good from here. I am not aware of any issues with the
colors. "Code Not Working" doesn't help us.

Are you using Conditional Formatting? What are your results? If you are
truly using code, then you should share the code.
 
M

Marshall Barton

Ben said:
I have a major request for the Dept of Justice. I have a report that looks
like this:

Task Type 4/5/2010 4/12/2010 4/19/2010
DSR St. Louis St. Louis
Exch RU Seatttle
Exch RU Memphis Memphis Memphis

What I need is code that will work. Basically if Task Type = DSR then the
background color of St. Louis and all other sites with "DSR" attached to it
should be Red. If the Task Type is Exch RU then it'll be Blue, etc.


You can use some code in the Format (or Print) event to do
that:

Select Case Me.[Task Type]
Case "DSR"
Me.Section(0).BackColor = vbRed
Case "Exch RU"
Me.Section(0).BackColor = vbBlue
Case ?
. . .
Case Else
MsgBox "Unknown task type"
End Select

You will probably want to make each of the text box's
BackStyle property to Transparent.

At some point, you will probably have to change a color or
even add a new task type so it might be worth investing some
time to remove the code's dependency on the task type. That
would be done by adding a color code field to the table that
defines the available task types.
 

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