Hi I need help!
I'm need to loop through the lables on a form and initially set them all so that their backcolor is white.
Then I need to loop through a DAO recordset and for each record where the id matched the id of a label I need ti change the colour to red.
I though i knew how to do this but even the code below fails! It sets the colour of the first lable then does nothing yet it is looping through them all.
What is going on here please?
I'm need to loop through the lables on a form and initially set them all so that their backcolor is white.
Then I need to loop through a DAO recordset and for each record where the id matched the id of a label I need ti change the colour to red.
I though i knew how to do this but even the code below fails! It sets the colour of the first lable then does nothing yet it is looping through them all.
What is going on here please?
Code:
Dim lngRed As Long, lngWhite As Long
lngRed = RGB(255, 0, 0)
lngWhite = RGB(255, 255, 255)
Dim ctl As Control
For Each ctl In Me.Detail.Controls
With ctl
If ctl.ControlType = acLabel Then
Debug.Print ctl.Name
.BackColor = lngRed
End If
End With
Next ctl