Change a value in a multi-column listbox

ino_mart

Registered User.
Local time
Today, 14:28
Joined
Oct 7, 2009
Messages
78
All

I have a listbox with 2 columns. The rowsource is not bounded. Values are picked up from a table. Colde below fills the first column of the listbox.
Code:
Do While Not rsExpectedColumns.EOF
    Me.lstColumns.AddItem rsExpectedColumns![Column]
    rsExpectedColumns.MoveNext
Loop

In next step the values in this listbox must be compaired with headers in an Excel-file. If the header is found in the Excel-file, the second column should contain an X.

So, let's assume I have a listbox with next values
Column 1 Column2
Counter
Name
Location
The Excel file I open only got Counter and Location. The listbox should display

Column1 Column2
Counter X
Name
Location X

I tried to use some code like
Code:
For intCounter = 0 to me.lstColumns.Listcount - 1
if Me.lstColumns.ItemData(intCounter)=ColumnSchema("Column_Name") Then
   Me.lstColumns.Column(intCounter, 1) = "X"
End If
Next
but the third line where I try to publish the "X" in the second column fails with error "Object required"

How can this be solved?

Regards
Ino
 
Last edited:

Users who are viewing this thread

Back
Top Bottom