How can I indicate with a color change in the label, that a checkbox is checked? I've got it working ...sort of. but when the change occurs it's happening gobally - I want the label to color to apply only to the record I'm viewing. If the check box is checked then the color should be red, otherwise black.
My code is as follows:
Active_Admission.Value = -1 Then
Label1177.ForeColor = vbRed
ElseIf Active_Admission.Value = 0 Then
Labe1177.ForeColor = vbBlack
Exit_Sub_Active_Admission_click:
Exit Sub
End If
End Sub
Also, the condition only works with -1 and 0 - I've read in other places that the condition is 1 and 0. HELP!
I have several forms that each has a dozen or more checkboxes, true/false. I want to be able to change the background color of the label of each checkbox depending on if the checkbox is true or false. I have used the following code which works great:
If Me.A = True Then Me.lblA.BackColor = vbYellow Me.lblA.BackStyle = 1 Me.lblA.ForeColor = vbRed Else Me.lblA.BackColor = vbWhite Me.lblA.ForeColor = vbBlack End If
Me.A refers to T/F checkbox A and Me.lblA refers to its label. This is repeated for each of the checkbox controls. If the control is [B], then its label is lblB. I have used this in the form OnCurrent event and the checkbox control OnUpdate event. I was wondering if I could use the tag property to this, saving me writing countless lines of code and having the OnCurrent event of each of the forms so long and cumbersome. And I do know that I can use conditional formatting to do this, but I would prefer not to use that method. Is there any way to do this using the tag property and not so many lines of code?
Is it possible to use two color fonts on one label? I want to bring attention to the user that by clicking a certain button they can perform a search by "Name" and by clicking on the other button, they can perform a search by "Appointment".
I have a switchboard type form with some buttons. The two buttons in question are labeled, "Search for Appts by Name" and "Search for Appts by Appointment". I want to keep the "Search for" section of the button in black font, but change the "by Appointment" and "by Name" to red font.
Using Access 2010. I have a form on which I've placed a simple label. I try to set the label border color to black but it shows grey. I can set the border color to #000000 and it's grey. I set it to #000001 and it shows black as expected.
I'm thinking it has something to do with the themes, but shouldn't an exact color code show as expected? As a new member (<10 posts) I can't post an actual link, but here's the text of the location: [URL] ....
Code: 'Pacer frame set to proper background If Me.FrmPacer.Value = 1 Then Me.LblPacer.BackColor = vbGreen ElseIf Me.FrmPacer.Value = 2 Then Me.LblPacer.BackColor = vbYellow ElseIf Me.FrmPacer.Value = 3 Then Me.LblPacer.BackColor = vbRed
[code]...
I have multiple frames on one subform that when selected sets a unassociated labels back color. Then when cancelled by undo code the back color stays on the color that it was changed to on afterupdate event from the frame with option controls. I would like to loop thru but could not come up with the proper method if it is even possible.the above code works after refreshed, but just wondering if there is a shorter or more efficient method.
I have the following module which displays the backcolor of a checkbox label if it is true or false
Private Sub FormatLabel(chk As Control) With chk.Controls(0) If chk Then .BackColor = vbYellow .BackStyle = 1 .ForeColor = vbRed
[Code] .....
Which works great! But I cannot figure out how to make it work in the control AfterUpdate Event. I tried using it in the current control's (checkbox) after update event
Dim itm As Control If itm.ControlType = 106 Then FormatLabel itm
but nothing happens (no change, no error message).
I have tried creating a new module:
Public Sub CheckBoxFormat(chk As Control) If chk = -1 Then chk.BackColor = vbYellow chk.BackStyle = 1 chk.ForeColor = vbRed Else chk.BackColor = vbWhite chk.ForeColor = vbBlack End If End Sub
But when I try to call it in the AfterUpdate event for the particular checkbox
Private Sub CheckBoxA_AfterUpdate() Dim itm As Control If itm.ControlType = 106 Then CheckBoxFormat itm End Sub
I get the error message "Expected Variable or Procedure not module"
So, (1) is my module all wrong or (2) am I calling it incorrectly or (3) wrong on both items?
I'm trying to make the backround color of a text box "prova" (short date value) changing according to the values of other two different text boxes "StartDate" and "EndDate" (both are short date values). I'd like the backround of prova to be blue if its value is between StartDate value and EndDate value. So in the code builder I made this function:
Private Sub prova_AfterUpdate()
If Me.prova.Value > Me.StartDate.Value & Me.prova.Value < Me.EndDate.Value Then
Me.[prova].BackColor = vbBlue
Else Me.[prova].BackColor = vbWhite End If
End Sub
Is that correct? Thank a slot for your help :confused:
=IIf([Text131] Between 16 And 30,"Unacceptable",IIf([Text131] Between 31 And 42,"Marginal",IIf([Text131] Between 43 And 56,"Effective",IIf([Text131] Between 57 And 71,"Very Good",IIf([Text131] Between 72 And 80,"Outstanding","")))))
It works just fine, but I was wondering if there'd be a way to change the text color of the <<true>> statement based on what it is? i.e. "Outstanding" and "Very Good" would be green, "Effective" could be yellow, "Marginal could be brown and "Unacceptable" could be red. How would I implement that into this expression, if that's even possible? Thanx for your assistance!
Hi. Is that even possible? I have form in datasheet view and text box on it. I need to change color of font in dependency of value of previous record. Maybe some kind of conditional formatting? Can somebody help?
I have a CONTINUOUS form that shows all my records. I want it to change the back color of a field when it is a certain value. so far i get it to change back color when the very first record in the list is a certain value, but then it will change the back color for every value and not just one value.
This is very close to the label question that I also have posted. I am trying to get my report to have the back ground of some text boxes turn yellow if they are populated. I can get them to turn yellow, but they turn yellow whether they are populated or not. I have the code in the Report Open event. Here is some of the code that I have.
If Not IsNull(MMSJob) Then MMSJob.BackColor = 65535 Else MMSJob.BackColor = vbWhite End If
I have a form which uses a query for entry to the table. One of the fields in the query is a calculated field which shows in the form. The calculated field returns a number from 1 to 5. Rather than showing this number I would like to show a round stoplight that changes color for each number. I have inserted a OLE object OLEunbound235 into the form. The colors I want to use are icolor = RGB(255, 204, 0) 'Gold icolor = RGB(192, 192, 192) 'Silver icolor = RGB(216, 129, 0) 'Bronze icolor = RGB(255, 255, 0) 'Yellow icolor = RGB(255, 0, 0) 'Red and icolor = RGB(255, 255, 255) 'White for any other value.
The text box that returns the calculated number is labeled Text1 and I have hidden this box so it can not be seen. Does anyone know how to write this code that would change the OLE object color automatically so when the user enters data into the form and the return number changes the color of the OLE object changes. I know very little about VBA and I am not sure where to begin or where to even write the code.
I have design a form using the tab control. I need to add in color to make it more professional. Is there a way I can do it. I realised the filled /Back color icon is faded in color in design view.
On a form I have a combo box - let's call it cmboSickness. it has two options "flu" and "malaria". On the same form I have two command buttons - one ehich opens a malaria form and one which opens a flu form. If I select flu then I want the words on the flu command button to change to red. How do I do this and where do I put the code?
I have tried - If me.cmbosickness=flu then cmdflu.color=255
I was wondering if anyone can help. Please see attached jpg I need to change the background color of the lead status box when one of the options is selected. i.e. when warm (amber) when Hot (red)
I have about 25 text boxes on my form that use the dcount or count functions to obtain a number. (Text boxes are labeled 'Text1' through 'Text25') When the value of the textbox is 0, I would like to have the color of the text box turn red.
Is there a way I can do this using a for loop? Or a with statement?
Checking each one individually just seems like poor programming. Any thoughts? Ideas? Thank you.
Not sure if this is can be done: I have a picture and I want to change its color in accordance with values in another textBox. Is that possible? if Yes, then what would be the procedure and the codes?
I have a problem with seting up color for my pivot chart. First I set up color I want(pic 1).but then when I use filter for End Customer all the colors will revert back to default settings (pic2).Is there a way how to force it so it sticks with colors I chose? VBA code?
I have this code that should change backgroundcolor in multiple items form based on a value of a field:
Private Sub Form_Current() 'check if field on form called somefield is DVD If Me.TYPE.Value = "DVD" Then Detail.BackColor = vbRed 'DVD Else Detail.BackColor = 16777215 'BOOK End If End Sub