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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Selection List Boxes

Status
Not open for further replies.

Muzzy

Programmer
Dec 14, 2001
68
GB
I have a multiple selection list box on a form, when more than one value is selected I need to 'walk' the list box and pick out each selected value and add it to a table with a key. The key is a unique identifier for the site but there will obvioulsy be multiple occurences of this .i.e.
31 public
31 private
31 Both
32 Private
etc.
Any help on this would be greatly appreciated.
 
Hi,
Modify the followinf code to suit your needs.


Private Sub AddListContents_Click()
'Code to open databse and table

dim lst as Variant
For each lst in Me.List1.ItemsSelected
rs.AddNew
rs.Fields("X")=Me.List1.Column(1, lst)
rs.Update
Next lst

'Close database
End Sub

This code will add the contents of the Second column of each row in the list box to the table. Hope it helps. Let me know what happens.
With regards,
PGK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top