Conditional Formatting in a report

E

ES

I have a report that list a single field out of a table. The field is
nothing but a system generated text string. I want to format the front and
back color of each row based on specific text in the string.

Example:

If the string contains the word “Current†then I want it to be black on
white

If the string contains the word “Prior†then I want blue on gray

I would like to go as far as having a line appear under certain groupings
based on the text in the string but that may be a bit much for my Access
skills.

Any help/tips would be appreciated.
 
D

Damian S

Hi ES,

Try this in the On Format event of the Detail section of your report:

If InStr(1, Me.TEXTBOX, "Current") Then
Me.Detail.BackColor = vbBlack
Me.Requirement.ForeColor = vbWhite
elseif instr(1, me.TEXTBOX, "Prior") then
Me.Detail.BackColor = vbBlue
Me.Requirement.ForeColor = vbBlack
Else
Me.Detail.BackColor = vbWhite
Me.Requirement.ForeColor = vbBlack

End If

Changing the colours above as applicable.

Hope this helps.

Damian.
 
E

ES

Works like a charm. Thanks!!

Damian S said:
Hi ES,

Try this in the On Format event of the Detail section of your report:

If InStr(1, Me.TEXTBOX, "Current") Then
Me.Detail.BackColor = vbBlack
Me.Requirement.ForeColor = vbWhite
elseif instr(1, me.TEXTBOX, "Prior") then
Me.Detail.BackColor = vbBlue
Me.Requirement.ForeColor = vbBlack
Else
Me.Detail.BackColor = vbWhite
Me.Requirement.ForeColor = vbBlack

End If

Changing the colours above as applicable.

Hope this helps.

Damian.
 
Top