Changing text color in vba

JPFred

Registered User.
Local time
Today, 16:09
Joined
Oct 29, 2017
Messages
47
This is more than likely a simple question.


I have a for that loads a record from a table and displays the record for editing.


What I would like to happen is to change the background and/or text in a combo box if the data coming in meets a given condition, I.E.


Code:
Private Sub Form_Load()

Dim background As String

background = "#ED1C24"

If Me.comcondition.Value = "5 - Poor" Then
    comcondition.BackColor = background
End If

End Sub


I hope this details my question / idea.


Doc
 
put your code in the current event rather than the open event. the recordset doesn't get loaded until the load event and the current record is not selected until the current event

alternative to vba code is to use conditional formatting
 
if this form is continuous you have to go with conditional formatting. Easier either way.
 

Users who are viewing this thread

Back
Top Bottom