tags:

views:

27

answers:

1

i need all the rectangles on my form to be red when the report opens. how do i do this?

here's my code:

Private Sub Report_Load()
    For Each ctl In fill_boxes.Controls
            If ctl.Name = acRectangle Then
                ctl.Name.BackColor = "#ED1C24"
            End If
    Next ctl
End Sub

i get an error OBJECT REQUIRED on this line: For Each ctl In fill_boxes.Controls

fill_boxes is the name of the report

how do i tweak the code to make all rectangles red on report open/?

+1  A: 

Is the BackStyle on the rectangle set to Transparent or Normal - Normal is what you want to be if you want to colour the contents of it.

ctl.Name.BackStyle = Normal
CodeSlave