user745778
user745778

Reputation: 97

Add color to text box based on value

The access report has the following script. The report has many records (or rows of data) and each one has the text box CompColor. So, the report colors all the CompColor text boxes the same, depending on which one you click in the report. How can I make each one correct based on teh value entered in that text box?

Private Sub Report_Current()
Select Case Me.CompColor
    Case "Green"
        Me.CompColor.BackColor = vbGreen
    Case "Red"
        Me.CompColor.BackColor = vbRed
    Case "Yellow"
        Me.CompColor.BackColor = vbYellow
    Case Else
        Me.CompColor.BackColor = vbWhite
End Select
End Sub

Upvotes: 0

Views: 1090

Answers (1)

iDevlop
iDevlop

Reputation: 25262

Use conditional formatting.

Upvotes: 0

Related Questions