HelloI have question, how I can change automatically label color? the color of the label is dependent on the values in the table.thank you very much in advance.
HelloI have question, how I can change automatically label color? the color of the label is dependent on the values in the table.thank you very much in advance.
You can't do it with continuous forms. EVERY label will get the same color.
but the code is in the ONCURRENT event:
Code:sub Form_oncurrent() select case txtBox Case "bob" VColor = vbRed Case "Sally" VColor = vbBlue end select label.forecolor = VColor
The forms in your sample db are not continuous, so depending on some result, you set the backcolor as already suggested, or use a construct like
If SomeConditionIsMet Then Me.Etykieta1.Backcolor = vbGreen
You say it depends on data values, but I can't tell from what or how by your sample since labels cannot have data associated with them. Your picture doesn't help me.
P.S. watch for any failure that might occur in further development from your inconsistent spelling of Workplace.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
So, how can I connect specific value with specific label, and then the values in the table change color automatically?
From what I've seen in your db, I see no reason to use a label. If you used a textbox control instead, you could use conditional formatting on it to set the color (if the control's data met your criteria). In order for you to color a label, you'd need a control on the form to supply the data, then have some event such as your label click to check the control value and set the color accordingly. If you're going to add a control anyway, I see no sense in having both. Of course, the form would need a record source and the controls would need a control source (as bound controls in your design scheme) OR the control source could be a DLookup if they must be unbound.
Other than that, I don't know what else to tell you because you've still not divulged much about what's behind this and what the process is.
Last edited by Micron; 07-30-2016 at 01:31 PM. Reason: clarification
So, I should use the texbox for every workplace on the "workplace map"? and what do next in the textbox?
It will be db with form "Workplace Map" and when you open it, you will see all the workplaces (map will be bigger than now) missing the computer, and additionally when you press some workplace you go to next form when you can check PC parameters.
As I tried to say In post #3 I don't know enough about what you are doing to answer. Maybe a more sensible approach is to have a combo box with a list from which you choose then display the related information. You will have to provide more info on the process; what that is and what you want to achieve.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.