Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing column valie in Value List Type ListBox 1

Status
Not open for further replies.

dabruins

Programmer
Mar 9, 2005
102
0
0
CA
I have a Value List type listbox (lstdeliverables) that contains three columns. The third column contains a "Quantity" value. I would like to allow the user to select any number of the rows in the listbox and update its quantity value for the row using a value from a textbox (txtNewQuantity) in the same form that the user would use to provide a new valid quantity value. Each time I do this using the following snippit of code I get an error 424 'Object Required'. Can anyone explain why this doesn't work? I thought this would be quite easy and straightforward.

For Each varItm In Me.lstdeliverables.ItemsSelected
Me.lstdeliverables.Column(2, varItm) = Me.txtNewQuantity
Next
 
Perhaps something like:
Code:
For j = 0 To Me.lstdeliverables.ListCount - 1
    For i = 0 To Me.lstdeliverables.ColumnCount - 1
        If Me.lstdeliverables.Selected(j) And i = 2 Then
            strNewList = strNewList & Me.txtNewQuantity & ";"
        Else
            strNewList = strNewList & Me.lstdeliverables.Column(i, j) & ";"
        End If
    Next
Next
'Debug.Print strNewList
Me.lstdeliverables.RowSource = strNewList
Me.Refresh
 
Hi Remou.

Your suggestions works great! I did have to set the Default Headings values in the strNewList string before looping through the columns and rows but it works perfectly. I guess you have to reset the entire rowsource value for the listbox or perform string replacement if possible on the existing rowsource string value. It doesn't permit direct row/column substitutions.

Thanks for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top