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!

Multi-select list box

Status
Not open for further replies.

Tiggertoo

MIS
May 28, 2003
66
0
0
US
After much searching in GOOGLE I've come up with... Surely there is someone in Tek Tips who can help??

Option Explicit
Private Function DivisionsSelected()
Dim Divisions As Variant
Dim strItems As String
For Each Divisions In Me![lstDivisions].ItemsSelected()
If Len(strItems) <> 0 Then strItems = strItems & Chr(13) & Chr(10)
strItems = strItems & Me![lstDivisions].Column(0, Divisions) & "," & Me![lstDivisions].Column(1, Divisions)
Next Divisions
DivisionsSelected = strItems

End Function

this give me a list to select from (text box-extended)
selections appear in another box by using.

Private Sub lstDivisions_AfterUpdate()
Div.Value = DivisionsSelected()
End Sub

This text box shows all values selected BUT only posts the first one selected to my table "DIV" field... What am I missing? I do need all chosen to reside in one field per record...
 
Are you looking to store data in one record, one field that ends up with

FirstItemSelected, SecondItemSelected, ThirdItemSelected... etc


or

Are you looking to store the data in multiple records based on those items selected?

BTW... did you hit the End key when you had the field selected in your table?? In the code you added a carriage return & Line Feed before each additional item selected and sometimes it's not easy to see the data in the field without hitting the End key.

PaulF
 
Looking for the Your first option (FirstItemSelected, SecondItemSelected, ThirdItemSelected... etc). I copied some one else's code so I wasn't aware that there was a carriage return & line feed... can I just remove that and what is it?

Thanks!

 
Get rid of Chr(13) & Chr(10)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top