I have a report with some data and is bound to a query.
The report consists of the months and some calculated values under each month.
The month headings contain the names of the month. Depending on criteria, I want the label containing the month name, to display a background color (Cyan). I use RGB(0, 255, 255). The code I use, as follows:
Code:
If Me("Label" & i).Caption = MonthName(i) And Month(TmpRptDate) < Month(Date) Then
Me("Label" & i).Caption = Me("Label" & i).Caption & " " & Format(Date, "yyyy") + 1
Me("Label" & i).BackColor = RGB(0, 255, 255)
ElseIf Me("Label" & i).Caption = MonthName(i) And Month(TmpRptDate) >= Month(Date) Then
Me("Label" & i).Caption = Me("Label" & i).Caption & " " & Format(Date, "yyyy")
End If
everything is fine, except that only the first label background is changed to Cyan. All the other labels that meet the first criteria, the backcolor stays white and is no changed. See picture below of the report. (All the months with |"2025" should be Cyan):
Any suggestions?
Thanks