List Box multiselect property problem

J

Jim Richards

-----Original Message-----
Hi

In a data entry form I've created, I have a list box, from which I want to
select more than one record. I've set the multiselect property to Simple,
but I don't know how to store the information selected, can any help?

Thanks


.See MultiSelect, ListIndex, Selected, and ItemsSelected
in Access help. Here is an interesting one from help.
Hope it helps:

Selected Property Example

The following example uses the Selected property to move
selected items in the lstSource list box to the
lstDestination list box. The lstDestination list box's
RowSourceType property is set to Value List and the
control's RowSource property is constructed from all the
selected items in the lstSource control. The lstSource
list box's MultiSelect property is set to Extended. The
CopySelected( ) function is called from the cmdCopyItem
command button.

Sub cmdCopyItem_Click()
CopySelected Me
End Sub

Function CopySelected(frm As Form) As Integer
Dim ctlSource As Control
Dim ctlDest As Control
Dim strItems As String
Dim intCurrentRow As Integer
Set ctlSource = frm!lstSource
Set ctlDest = frm!lstDestination
For intCurrentRow = 0 To ctlSource.Listcount - 1
If ctlSource.Selected(intCurrentRow) Then
strItems = strItems & ctlSource.Column(0, _
intCurrentRow) & ";"
End If
Next intCurrentRow
' Reset destination control's RowSource property.
ctlDest.RowSource = ""
ctlDest.RowSource = strItems
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top