Letter Color Code Check

K

Kenny G

Using Access 2003: Below is my code for a list box called Unit. I am trying
to get the listed Units to show up in blue after update. The problem is all
units are showing up blue. Would someone tell me what is wrong. Thanks!

Private Sub Unit_AfterUpdate()
If Me.Unit = "Closed Access Unit-1694" Then
Me.Unit.ForeColor = vbBlue
If Me.Unit = "Clinical Decision Unit-1620" Then
Me.Unit.ForeColor = vbBlue
If Me.Unit = "Emergency Center-1611" Then
Me.Unit.ForeColor = vbBlue
If Me.Unit = "PACU-1692" Then
Me.Unit.ForeColor = vbBlue
If Me.Unit = "Psych Emergency Care-687" Then
Me.Unit.ForeColor = vbBlue
If Me.Unit = "6th Floor Mixed" Then
Me.Unit.ForeColor = vbBlue
Else
Me.Unit.ForeColor = vbBlack
End If
End If
End If
End If
End If
End If
End Sub
 
S

Stuart McCall

Kenny G said:
Using Access 2003: Below is my code for a list box called Unit. I am
trying
to get the listed Units to show up in blue after update. The problem is
all
units are showing up blue. Would someone tell me what is wrong. Thanks!

Private Sub Unit_AfterUpdate()
If Me.Unit = "Closed Access Unit-1694" Then
Me.Unit.ForeColor = vbBlue
If Me.Unit = "Clinical Decision Unit-1620" Then
Me.Unit.ForeColor = vbBlue
If Me.Unit = "Emergency Center-1611" Then
Me.Unit.ForeColor = vbBlue
If Me.Unit = "PACU-1692" Then
Me.Unit.ForeColor = vbBlue
If Me.Unit = "Psych Emergency Care-687" Then
Me.Unit.ForeColor = vbBlue
If Me.Unit = "6th Floor Mixed" Then
Me.Unit.ForeColor = vbBlue
Else
Me.Unit.ForeColor = vbBlack
End If
End If
End If
End If
End If
End If
End Sub

Access listboxes cannot do this. See if Stephen Lebans has a replacement
control (lebans.com).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top