Populate list box

IanT

Registered User.
Local time
Today, 20:00
Joined
Nov 30, 2001
Messages
191
I have two list boxs on a form, lstDescription Rowsource to a query, lstHold is unbound. What I would like to do is when you select a record in lstDescription, put the record in lstHold, this could be just one record or build up many records in lstHold.

I have tried using this could with out success, can anyone help.

Dim varItem As Variant
Dim strCriteria As String

For Each varItem In Me!lstDescription.ItemsSelected
strCriteria = strCriteria & ",'" & Me!lstDescription.ItemData(varItem) & "'"
Next varItem
If Len(strCriteria) = 0 Then
MsgBox "You did not select anything from the list" _
, vbExclamation, "Nothing to find!"
Exit Sub
End If
strCriteria = Right(strCriteria, Len(strCriteria) - 1)

Me!lstHold.RowSource = strCriteria

Thanks in advance!
 

Users who are viewing this thread

Back
Top Bottom