Solved Save listbox column (1) data as Delimited (1 Viewer)

oxicottin

Learning by pecking away....
Local time
Today, 03:04
Joined
Jun 26, 2007
Messages
856
Hello, I have a listbox that shows employees names and I wanted to save the list as a Delimited list separated by comma in my textbox txtCrewOneDelimited . I can get it to work BUT I need to save what's in the second hidden column of the listbox and not the first column which is and employee ID number and second column is a employee name. If I change the lstCrewOneEmployeeNames to lstCrewOneEmployeeNames.Column(1) then I get an error 424 Object Required.

Code:
  Dim sList As String
  Dim nIndex As Integer

  For nIndex = 0 To lstCrewOneEmployeeNames.ListCount - 1
    sList = sList & lstCrewOneEmployeeNames.ItemData(nIndex) & ","
  Next
  sList = Left$(sList, Len(sList) - 1)

   Me.txtCrewOneDelimited = sList
 

theDBguy

I’m here to help
Staff member
Local time
Today, 00:04
Joined
Oct 29, 2018
Messages
21,473
Can you also post the code that's getting an error?

Did you try to use Column(1, nIndex)?
 

oxicottin

Learning by pecking away....
Local time
Today, 03:04
Joined
Jun 26, 2007
Messages
856
Can you also post the code that's getting an error?
your Column(1, nIndex) worked, Thanks!

Code:
  Dim sList As String
  Dim nIndex As Integer


  For nIndex = 0 To lstCrewOneEmployeeNames.ListCount - 1
    sList = sList & lstCrewOneEmployeeNames.Column(1, nIndex) & ","
  Next
  sList = Left$(sList, Len(sList) - 1)

   Me.txtCrewOneDelimited = sList
 
Last edited:

theDBguy

I’m here to help
Staff member
Local time
Today, 00:04
Joined
Oct 29, 2018
Messages
21,473
your Column(1, nIndex) worked, Thanks!

Code:
  Dim sList As String
  Dim nIndex As Integer


  For nIndex = 0 To lstCrewOneEmployeeNames.ListCount - 1
    sList = sList & lstCrewOneEmployeeNames.Column(1, nIndex) & ","
  Next
  sList = Left$(sList, Len(sList) - 1)

   Me.txtCrewOneDelimited = sList
Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Top Bottom