Question : Conditional Formatting in a ListBox (Access :: VBA)

Hello Experts,
I am building a search form that will search for inactive/active records.  What I am trying to do is have the inactive records appear in grey and the active records to appear blue.  For each record, there is an attribute called blnActive that returns true/false values.
 
I am capable of determining the SQL, however, I need assistence with the VBA syntax.  Here is my pseudo code:

For i = 1 To rec Step 1
                item = rsP.Fields(0) & ";" & rsP.Fields(1)
                If rsP.Fields(2) = False Then
                    ' this line item should be 8421504
                Else
                    ' this line item should be 0
                End If
                Me.lstGrant.AddItem (item)
                rsP.MoveNext
            Next i

Thank you for your quick response!

Wendee

Answer : Conditional Formatting in a ListBox (Access :: VBA)

Individual lines in a standard ListBox cannot be formatted in any manner.  ALL lines will be of the same FONT, SIZE, BOLD/UNBOLD, COLOR...

Your only hope MIGHT be to use a Third Party listView control, but I cannot suggest any to look into, becuase Access only uses ActiveX (COM) controls, and with the introduction of .NET, no vendors are still selling COM/ActiveX controls for any purpose.

AW
Random Solutions  
 
programming4us programming4us