barryjohnson
Technical User
I have a ComboBox called "cboPlatform". I query a Access Database and populate cboPlatform from a Products Table with all the Distinct values in the Field called Platform. Then I query a second Access Database that also has a Products Table/Platform Field and compare the values in that Products Table against those already loaded in cboPlatform.
If I find a value in the second Products Table, I add it to cboPlatform. It works fine. But, I'd like to be able to set the ForeColor to vbRed for the values added from the second table. Here is my code that loads the values from the second Products Table.
Also, the values from the second table get added to the bottom of cboPlatform. I'd like to re-sort cboPlatform once I get the values from the second table -- keeping my vbRed attribute with the values from the second table.
Any ideas? Thanks
Set dbsObject = wksObject1.OpenDatabase(dbPathUser, , True)
Set rstObject1 = dbsObject.OpenRecordset( _
"SELECT DISTINCT [PLATFORM] " & _
"FROM PRODUCTS " & _
"ORDER BY [PLATFORM] ASC"
If rstObject1.RecordCount > 0 Then
rstObject.MoveLast
rstObject.MoveFirst
For Ndx = 1 To rstObject1.RecordCount
For Ndx1 = 0 To cboPlatform.ListCount - 1
If cboPlatform.List(Ndx1) = rstObject1.Fields "PLATFORM"
.Value Then
Found = True
End If
Next
If Not Found Then
cboPlatform.AddItem rstObject1.Fields("PLATFORM"
.Value)
''' THIS IS WHERE I FEEL I NEED TO ADD SOMETHING TO TURN
''' THE NEXT ADDEDItem vbRED IN cboPlatform
End If
Found = False
rstObject1.MoveNext
Next
''' I NEED TO DO A RE-SORT DOWN HERE, BEFORE I LEAVE THE SUB
End If
If I find a value in the second Products Table, I add it to cboPlatform. It works fine. But, I'd like to be able to set the ForeColor to vbRed for the values added from the second table. Here is my code that loads the values from the second Products Table.
Also, the values from the second table get added to the bottom of cboPlatform. I'd like to re-sort cboPlatform once I get the values from the second table -- keeping my vbRed attribute with the values from the second table.
Any ideas? Thanks
Set dbsObject = wksObject1.OpenDatabase(dbPathUser, , True)
Set rstObject1 = dbsObject.OpenRecordset( _
"SELECT DISTINCT [PLATFORM] " & _
"FROM PRODUCTS " & _
"ORDER BY [PLATFORM] ASC"
If rstObject1.RecordCount > 0 Then
rstObject.MoveLast
rstObject.MoveFirst
For Ndx = 1 To rstObject1.RecordCount
For Ndx1 = 0 To cboPlatform.ListCount - 1
If cboPlatform.List(Ndx1) = rstObject1.Fields "PLATFORM"
Found = True
End If
Next
If Not Found Then
cboPlatform.AddItem rstObject1.Fields("PLATFORM"
''' THIS IS WHERE I FEEL I NEED TO ADD SOMETHING TO TURN
''' THE NEXT ADDEDItem vbRED IN cboPlatform
End If
Found = False
rstObject1.MoveNext
Next
''' I NEED TO DO A RE-SORT DOWN HERE, BEFORE I LEAVE THE SUB
End If