|
Subject:
|
Conditional Formatting on report in Access
|
|
Posted By:
|
bronen
|
Post Date:
|
7/23/2008 11:41:33 AM
|
I have a report that pulls data from a table and has the values of Red, Green, Blue, White, Yellow, Purple, Gold. I want the background behind each of those colors to be that color. So if the report shows Blue, then the text is Black in color but the background behind it is blue.
Here is my code thus far:
Select Case Me.PreviousStatus.Value Case "Blue" Me.PreviousStatus.BackColor = 16711680 Case "Green" Me.PreviousStatus.BackColor = RGB(0, 255, 0) Case "Red" Me.PreviousStatus.BackColor = RGB(255, 0, 0) Case Else Me.PreviousStatus.BackColor = vbWhite End Select
|
|
Reply By:
|
mmcdonal
|
Reply Date:
|
7/23/2008 11:49:35 AM
|
I assume you are putting this on the Detail section's On Format event. Is this working for you? If not, what errors are being thrown?
I think your readers may have a hard time with seeing black letters against at least that green value.
mmcdonal
Look it up at: http://wrox.books24x7.com
|
|
Reply By:
|
mmcdonal
|
Reply Date:
|
7/23/2008 11:56:20 AM
|
Actually, in trying this out, I find you want to specify the same color values. Use the Back Color color picker and insert the values you would have show up in the code, like this:
Select Case Me.Color Case "Blue" Me.Color.BackColor = 16711680 Case "Red" Me.Color.BackColor = 255 Case "Green" Me.Color.BackColor = 65280 Case Else Me.Color.BackColor = 16777215 End Select
This worked the way you want it to.
mmcdonal
Look it up at: http://wrox.books24x7.com
|
|
Reply By:
|
SerranoG
|
Reply Date:
|
8/1/2008 7:33:44 AM
|
As MMcDonal points out, what exactly is the error or problem? I also suggest using intrinsic constants.
Select Case Me.PreviousStatus Case "Blue" Me.PreviousStatus.BackColor = vbBlue Case "Green" Me.PreviousStatus.BackColor = vbGreen Case "Red" Me.PreviousStatus.BackColor = vbRed Case Else Me.PreviousStatus.BackColor = vbWhite End Select
Greg Serrano Michigan Dept. of Environmental Quality, Air Quality Division
|