How to import a multi select List Box into an Access table ?
Posted on 2006-11-07
I created a ListBox named List481 which reads a table Y containing a field named Branch defined as an nvarchar type field.
Table Y, field Branch is the Row Source of the ListBox List481.
The ListBox is to allow the user to select multiple braanches. One branch selected per row.
Do you know how I could modify the following Sub Procedue to get a result set that I could then load into a table X with 1 field
also named Branch which would be populated with the Branches selected from List481 listbox.
Currently, the value returned as a result of selecting Branches 101 and 102 from the ListBox is as follows:
strInSt = "001"002"
I would eventually import the strInSt into an Access table X with field Branch.
Private Sub List481_AfterUpdate()
Dim lst As Access.ListBox
Dim vnt As Variant
Dim strBranch As String
Dim intColCount As Integer
Dim strCycle As String
Dim bolCycle As Boolean
'Dim strInSt As String
Dim strQ As String
strQ = Chr$(34)
strInSt = ""
Set lst = Me.List481
For Each vnt In lst.ItemsSelected
intColCount = lst.ColumnCount
strBranch = lst.Column(0, vnt)
strInSt = strInSt & strBranch & strQ