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!

need help with selecting items using dual list boxes...

Status
Not open for further replies.

marlun

Programmer
Feb 7, 2003
70
0
0
SE
Hi! I read thread faq702-4246 (There they use a value list for the list boxes, What i need is to use a query i have. But the problem is that I don't know how to implement that in the code on that page.

happy for any help
 
You can either manually set the query in listbox or instead set the rowsource property in the Form_open event instead of using Loadlist that the Faq author wrote. In either case the Row Source type needs to be changed to "Table/Query".

I really didn't pick the code apart that much but I hope this gets you started.
 
Hi Folks,
I was trying to populate one ListBox, lstSelectedProviders(Column Count 3) with the selected row from another ListBox, lstAllProviders(Column Count 3) by the method indicated here. FAQ702-4246 ( . Unfortunately when the number of selection are high, the String variable has an upperbound and the join function reaches the limit. The RowSource of the destination ListBox also has a problem when the number of selections are high. The error message I receive is "The setting for this property is too long". The destination ListBox has RowSourceType = "Value List". Is there a way I can overcome this problem?? Any suggestions will be helpful

Dim vCurrentRow As Variant
Dim sRowSource As String
Dim I As Integer
Dim vSelectedValues(1500) As Variant

I = 0
vSelectedValues(I) = Me.lstAllProviders.Column(0, 0)
vSelectedValues(I + 1) = Me.lstAllProviders.Column(1, 0)
vSelectedValues(I + 2) = Me.lstAllProviders.Column(2, 0)
I = 3

For Each vCurrentRow In Me.lstAllProviders.ItemsSelected
vSelectedValues(I) = Me.lstAllProviders.Column(0, vCurrentRow)
vSelectedValues(I + 1) = Me.lstAllProviders.Column(1, vCurrentRow)
vSelectedValues(I + 2) = Me.lstAllProviders.Column(2, vCurrentRow)
I = I + 3
Next vCurrentRow

sRowSource = Join(vSelectedValues, ";")
Me.lstSelectedProviders.RowSource = sRowSource

Regs
Philipose
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top