Back Color change with VBA

mjreiman

Registered User.
Local time
Today, 08:18
Joined
Jan 29, 2010
Messages
25
My boss recently lost a good portion of his vision. So I took it upon myself to create a feature with my Invoice form where in the Status combo box, the value will change the back color. When Status = "Done", I want the Details area to have a back color of green. This is my code so far, I have tried setting my variable as Properties instead of String and I still get an error:

Private Sub Status_AfterUpdate()
Dim strStatus As String
strStatus = Me.Status.Value

Select Case strSatus
Case "Done"
Me.Detail.BackColor = "green"
Case Else
Me.Detail.BackColor = "yellow"
End Select
End Sub
 
Have you tried Conditional Formatting? It would be easier and would work in a continuous or datasheet, where what you have would only work in single view.
 
Try replacing "Green" With 4259584 and "Yellow" with 65535
 
or use:

Code:
Private Sub Status_AfterUpdate()
Dim strStatus As String
strStatus = Me.Status.Value

Select Case strSatus
Case "Done"
Me.Detail.BackColor = vbGreen
Case Else
Me.Detail.BackColor = vbYellow
End Select
End Sub

for more constants search the Access help fle for: Color Constants
 

Users who are viewing this thread

Back
Top Bottom