Conditional Formatting in a report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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.
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top