wendeenelson
asked on
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Is there a resource where I can retrieve the properties of ctList? (i.e. the equivalent of "rowsource" and "additem" syntax terms.)
Thank you.
Thank you.
dbi-tech rocks :-)
mx
mx
ASKER
This is what I came up with for my code:
If rs.RecordCount > 0 Then
rs.MoveLast
rsCt = rs.RecordCount
rs.MoveFirst
For i = 0 To rsCt - 1 Step 1
intFunderID = rs.Fields(0)
txtName = rs.Fields(1)
blnActive = rs.Fields(2)
item = intFunderID & ";" & txtName & ";" & blnActive
Me.ctList.AddItem (item)
rs.MoveNext
Next i
End If
Where do I put the formatting code? What is the syntax?
Thank you for your continued help.
If rs.RecordCount > 0 Then
rs.MoveLast
rsCt = rs.RecordCount
rs.MoveFirst
For i = 0 To rsCt - 1 Step 1
intFunderID = rs.Fields(0)
txtName = rs.Fields(1)
blnActive = rs.Fields(2)
item = intFunderID & ";" & txtName & ";" & blnActive
Me.ctList.AddItem (item)
rs.MoveNext
Next i
End If
Where do I put the formatting code? What is the syntax?
Thank you for your continued help.
ASKER
I have decided not to use DBI-Tech's controllers afterall.
I will accept the fact that I cannot change colors of the text. Instead, I created a conditional statement:
IF blnActive = False then
txtActive = "Inactive"
else
txtActive = "Active"
end if
Then I am just displaying that in a column next to the Funder names. Where I stand right now, this discussion is complete.
I will accept the fact that I cannot change colors of the text. Instead, I created a conditional statement:
IF blnActive = False then
txtActive = "Inactive"
else
txtActive = "Active"
end if
Then I am just displaying that in a column next to the Funder names. Where I stand right now, this discussion is complete.
"I have decided not to use DBI-Tech's controllers afterall. "
Just curious as to why not?
mx
Just curious as to why not?
mx
ASKER
As far as I can tell, there is very little documentation for syntax out there. I spent $400 on this software and the company wants to charge me more $$$ to get help developing with their product.
Do you another resource for DBI-Tech Development Documentation?
Do you another resource for DBI-Tech Development Documentation?
Last I knew, all DBI controls come with a complete help file and sample mdb, certainly better documentation and example that M# has every produced.
mx
mx
ASKER
They do, but it doesnot go far enough with explaining how the ListCargo works.- I am new to that arena
ASKER
I have had help with this problem before. However, someone on EE deleted my question that was reserved in my Knowledge Base. :- |
In addition to VBA, I work with Component Toolbox (which is ActiveX). Part of me doubts that is what I used before to solve this problem, but I will double check.
Thank you, once again!