Back Color change with VBA (1 Viewer)

mjreiman

Registered User.
Local time
Yesterday, 21:55
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
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 21:55
Joined
Aug 30, 2003
Messages
36,139
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.
 

John Big Booty

AWF VIP
Local time
Today, 14:55
Joined
Aug 29, 2005
Messages
8,262
Try replacing "Green" With 4259584 and "Yellow" with 65535
 

HiTechCoach

Well-known member
Local time
Yesterday, 23:55
Joined
Mar 6, 2006
Messages
4,357
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

Top Bottom