How to highlight a column item on a list box

mlai08

Registered User.
Local time
Today, 15:20
Joined
Dec 20, 2007
Messages
110
I have a form which provides users the feature to select names on the employee list box (linked to the employees table) on the left and move them to the manager list box (linked to the managers table) on the right. Status of some employees are active and some inactive. I want to be able to highlight people with an inactive status, say in red on both list boxes.

The list boxes contain row source with 4 columns (EmpID, LastName, FirstName & Status) from their respective source tables.

I tried the following codes but they don't work:

Private Sub lstAllEmps_Enter()

If Me.lstAllEmps.Column(3) = "Inactive" Then
Me.lstAllEmps.ForeColor = 255
End If

End Sub

The database is attached. Can anyone help me with this? :confused:
 

Attachments

Not sure you can do this with a list box. You could use a continuous sub form and design it so that it looks like a list box, using perhaps check boxes to select rows that are to be transferred to the other "list box". You could then use Conditional Formatting of the subform to highlight certain rows. You would need to modify whatever code you're currently using because I assume you are using the .ItemsSelected property of the list box.

If you want to stick with the list box method you might see what Stephan Lebans has here.
 
Not sure you can do this with a list box. You could use a continuous sub form and design it so that it looks like a list box, using perhaps check boxes to select rows that are to be transferred to the other "list box". You could then use Conditional Formatting of the subform to highlight certain rows. You would need to modify whatever code you're currently using because I assume you are using the .ItemsSelected property of the list box.

If you want to stick with the list box method you might see what Stephan Lebans has here.

Thanks for your comments. I know there are other options by using continuous form but I am unsure if it worth the effort since highlighting inactive employees is a nice to have feature. I prefer sticking to the list box version. BTW, I can not open the link from Stephan Lebans. Can you please re-post it.
 
I read your post a while ago, then got distracted by life (don't you hate when that happens?) but I was going to offer the exact same advice. It really is the only way I can think of to approximate your need, but like yourself, it seems a bit too much work for too little gain.

Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom