Selected items from List Box sent to Form Field

G

geotalk2bs

When items are selected from a list box (frm!List52), they currently
populate another list box (frm!List56) but I would like the selections
made to also update a field (T_assigned) on the form. Currently frm!
List56 is populated with first name and last name data - Columns 1 and
2 - I am trying to get the selected ID_NUMs from Column 0 into the
T_assigned field. Any help or guidance would be greatly appreciated,
thanks.

______________________________________________
Public Sub CopySelected(ByRef frm As Form)

Dim ctlSource As Control
Dim ctlDest As Control
Dim strItems As String
Dim intCurrentRow As Integer

Set ctlSource = frm!List52
Set ctlDest = frm!List56

For intCurrentRow = 0 To ctlSource.ListCount - 1
If ctlSource.Selected(intCurrentRow) Then
strItems = strItems & ctlSource.Column(2, _
intCurrentRow) & " " & ctlSource.Column(1, _
intCurrentRow) & ";"
End If
Next intCurrentRow

' Reset destination control's RowSource property.
ctlDest.RowSource = ""
ctlDest.RowSource = strItems

Set ctlSource = Nothing
Set ctlDest = Nothing

End Sub
 

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