Hi I am trying to resolve the problem of my work.
I have program that is searching through the database. I have a lot of controls labels. I want to change the specific label color by looping.
This works for all controls to disable the color. It is OK. on current form action
Now I want to use loop to do oncllick action when I press "label1" the right record is set. And the "BackStyle =1" and the "BackColor" is set to the desired one.
I have program that is searching through the database. I have a lot of controls labels. I want to change the specific label color by looping.
This works for all controls to disable the color. It is OK. on current form action
Code:
Public Function ZmienKolor()
Dim con As Control
For Each con In Me.Controls
If TypeOf con Is Label Then
con.BackStyle = 0
End If
Next con
'*****************************
'odwołanie do formualrza Drukuj i jego zestwau kontrolek
'aby odwołać się do ctl muszę niejawnie otworzyć formualarz
DoCmd.OpenForm "Drukuj", acDesign, , , , acHidden
Dim ctl As Control
'zmienia kolor 0 w formularz Drukuj
For Each ctl In Forms!Drukuj.Controls
If TypeOf ctl Is Label Then
ctl.BackStyle = 0
End If
Next ctl
End Function
Now I want to use loop to do oncllick action when I press "label1" the right record is set. And the "BackStyle =1" and the "BackColor" is set to the desired one.