Display coloured rectangle, where colour changes based on table data

JKK

Registered User.
Local time
Today, 15:59
Joined
May 4, 2011
Messages
19
Hey guys,

It's been a while since I was last here, but I need to scratch your brains for some advice.

Some background info:
I have a table named tblCompanies. In this table, there is a field named BeenContacted. The BeenContacted field is a checkbox on my form so would take a Yes/No value.

My Problem:
I would like to have a rectangle appear on the report alongside the company's name. I want the rectangle to be green if BeenContacted was True and red if BeenContacted was false for that specific company.

Any advice would be appreciated. Thank you in advance!
 
You can add VBA code to the Detail_Format section of your report that will apply or change the back color to your rectangle based on the value of the checkbox.

Code:
If Me.chkBeenContacted = True Then
    Me.recStatus.BackColor = RGB(255, 0, 0)
Else
    Me.recStatus.BackColor = RGB(0, 201, 87)
End If

You can also make the field with the checkbox not visible so you do not see it.

Here is a link to a location where you can get all of the RGB color codes.
http://cloford.com/resources/colours/500col.htm
 
Thanks, that helped.
 

Users who are viewing this thread

Back
Top Bottom