Conditional Formating a Textbox in report...

  • Thread starter Thread starter chemicals
  • Start date Start date
C

chemicals

I have a report that I want to change any empty fields (textboxes) to have a
red background. I cannot seem to get backgound colors to work?

If I set conditional formatting on a value < 10 with text color changing it
seems to work.

Here's my 2 attempts:

Len([NumberOfReps])<1 Or IsNull([NumberOfReps]) ---set background to red

Then I tried this in the OnFormat event of the Detail section:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Not Len(Me.NumberofReps) >= 1 Then
Me.NumberofReps.BackColor = vbRed
End If
End Sub

Background colors don't seem to change???
 
Never mind!!!

I had the textbox properties for BackStyle as Transparent instead of
Normal......Duh!
 
Assuming this is Access 2000 or later, you don't need any code. Just use
Conditional Formatting.

1. In report design view, select the NumberOfReps text box.

2. Choose Conditional Formatting on the Format menu.

3. Set Condition 1 to:
Expression: [NumberOfReps] Is Null
and choose the color in the bucket.
 
Back
Top