List Box Rowsource (1 Viewer)

D

doop

Guest
I'm trying to write code to display values from an array into a
3 colunm listbox.
I have the set the Rowsourcetype="Value List"

I have problem building a delimted string, any suggestions
 

ritchieroo

Registered User.
Local time
Today, 22:13
Joined
Aug 2, 2002
Messages
80
VB6 offers the Join function which will do this easily, but it is missing from VBA (unless it's been added to more recent versions).

If you don't have it try this replacement...

Public Function Join(ByVal SourceArray As Variant, _
Optional ByVal Delimiter As Variant) As String
Dim sJoin As String
Dim vValue As Variant
If IsMissing(Delimiter) Then Delimiter = " "
If Not IsArray(SourceArray) Then Exit Function
For Each vValue In SourceArray
sJoin = sJoin & vValue & Delimiter
Next
sJoin = Left$(sJoin, Len(sJoin) - Len(Delimiter))
Join = sJoin
End Function
 
Last edited:

llkhoutx

Registered User.
Local time
Today, 16:13
Joined
Feb 26, 2001
Messages
4,018
Try building your list in the QBE frame. They replicate that code in your rowsource property.
 

Users who are viewing this thread

Top Bottom