Q
Q
I am trying to create a multiselect list box in a form. I
have made a list box listing the 5-6 choices and have
added an inidivual add and remove button, as well as
another list for the selected choices to go into. I am
able to select the items and move them to the new list
box. The problem I am having is that once I have selected
the items and saved the form, they do not go into the
field of table desired. The field is blank. What is
needed to save the selections to the field?
Below is the code I have so far for the event procedure.
Private Sub Add_Button_Click_Click()
Dim VaxListCounter As Integer, VaxCurrentCounter As
Integer
Dim VaxListItems As Integer, VaxCurrentItems As
Integer
Dim ListStr As String, FoundInList As Integer
VaxListItems =
have made a list box listing the 5-6 choices and have
added an inidivual add and remove button, as well as
another list for the selected choices to go into. I am
able to select the items and move them to the new list
box. The problem I am having is that once I have selected
the items and saved the form, they do not go into the
field of table desired. The field is blank. What is
needed to save the selections to the field?
Below is the code I have so far for the event procedure.
Private Sub Add_Button_Click_Click()
Dim VaxListCounter As Integer, VaxCurrentCounter As
Integer
Dim VaxListItems As Integer, VaxCurrentItems As
Integer
Dim ListStr As String, FoundInList As Integer
VaxListItems =
- .ListCount - 1
VaxCurrentItems = [Cap].ListCount - 1
For VaxListCounter = 0 To VaxListItems
If- .Selected(VaxListCounter) = True Then
If IsNull([Cap].RowSource) Then
ListStr =- .Column(0,
VaxListCounter) & ";"
[Cap].RowSource = ListStr
Else
FoundInList = False
For VaxCurrentCounter = 0 To
VaxCurrentItems
If [Cap].Column(0, VaxCurrentCounter)
=- .Column(0, VaxListCounter) Then
FoundInList = True
End If
Next VaxCurrentCounter
If Not FoundInList Then
ListStr = [Cap].RowSource &- .Column(0, VaxListCounter) & ";"
[Cap].RowSource = ""
[Cap].RowSource = ListStr
End If
End If
End If
Next VaxListCounter
End Sub
Private Sub Remove_Button_Click_Click()
Dim ListStr As String
Dim VaxCurrentItems As Integer, VaxCurrentCounter As
Integer
Dim VaxListItems As Integer
VaxListItems = [Cap].ListCount - 1
ListStr = ""
For VaxCurrentCounter = 0 To VaxListItems
If [Cap].Selected(VaxCurrentCounter) = False Then
ListStr = ListStr & [Cap].Column(0,
VaxCurrentCounter) & ";"
End If
Next VaxCurrentCounter
[Cap].RowSource = ""
[Cap].RowSource = ListStr
End Sub
- .Column(0, VaxListCounter) & ";"
- .Column(0, VaxListCounter) Then
- .Column(0,
- .Selected(VaxListCounter) = True Then