Changing the background of a specific row

R

renniw one

Hi,
I am able to display the contents of a table to a form in datasheet
mode. I would like to change the background of the rows displayed to red or
blue depending on what the value of one column is. For example,

First Last Color
John Doe 'r'
Jack Roland 'b'
Peter Feller 'r'
....

If the Color field is 'r', then the row should be in red and if it is blue,
the row color should be blue. Is there a way to get this done in MS Access?

- Ren
 
A

Albert D. Kallal

If you are using a2000 and later, you can use conditional formatting to do
this.

I would take your continues form, and expend it to two lines deep (after you
get this working...then re-size back to one line).

Add a new text box (with not label), and make the text box the SAME length
as all the controls above.

Now, select this long box, and then go

format->conditional formatting

Change the drop box to "expression"

Then, in the expression field put
([color] = "r")

Now, click on the "fill" color icon, and choose red.

Then, click "add",

Now, repeat this for each color
([color] = "b") .... select fill color = blue

Test this. Now, change all of the current text boxes background setting to
transparent, and move the long text box up. Select format, and "send to
back" to move the box behind all these details boxes. (take out the tab stop
from the long text box also...)

You can also just use the conditional format on EACH text box on the detail
line, and not use that extra "long" text box. (this works better, as then
when you edit the data....the back color remains..but then you need 3
conditional formats for EACH text box on the line).
 
Top