Question Conditional Formatting for Report Shapes (1 Viewer)

dbabaracus

New member
Local time
Today, 15:38
Joined
Jul 26, 2017
Messages
4
Is there a way to use conditional formatting for lines or shapes in Report headers?

For example, let's say I'm reporting on groups of color. Instead of using the color field in the header so that it says "Red", "Orange", "Blue" as text, we want to just have a colored line in the header. In the past, we've had separate reports so that the Blue report would only pull Blue records and it had a blue line in its formatting, and so on for each color group.

What I'd like to do is have a single report that can change its line color dynamically based on the Color field in the records. Instead of separate reports for each color, there'd be some sort of formatting rules that say "If <Color field> equals 'BLU' then set line color to <blue color formatting>", "If <Color field> equals 'RED' then set line color to <red color formatting>", etc.
 

isladogs

MVP / VIP
Local time
Today, 19:38
Joined
Jan 14, 2017
Messages
18,186
You can't do this using the CF wizard.
However it is possible do do this using VBA.
For example:

Code:
Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)
    Me.lblHeader.Caption = "JSON File Structure Summary - " & Me.FileName
    
   If Me.FileName = "Colours.json" Then
       [B] [COLOR="DarkRed"]Me.Line32.BorderColor = vbRed[/COLOR][/B]
    Else
        Me.Line32.BorderColor = vbBlack
    End If
End Sub
 
Last edited:

Mark_

Longboard on the internet
Local time
Today, 12:38
Joined
Sep 12, 2017
Messages
2,111
Alternate option, in what ever parent record you use for your reports have a text field for color.

When you open your report, in the On Load,

Me.Shape_Name.BackColor = Me.Filename.Color

Hope this helps!
 

Users who are viewing this thread

Top Bottom