Alex said:
This is the exact code I tried is below, I get the error message
"method 'item' of object 'forms' failed"
also each of the values i'm selecting contain a period (.)
Public Sub alex()
Dim lstbox As Variant
lstbox = Forms![frmUpload]![lstfiles]
With lstbox
For Each varItem In .ItemsSelected
strlist = strlist & ";" & .Column(1, varItem)
Next varItem
Forms![frmUpload]![lstSelected].RowSource = Mid(strlist, 2)
End With
End Sub
This statement is wrong:
lstbox = Forms![frmUpload]![lstfiles]
That would set lstbox to the value, if any, of the list box
Forms![frmUpload]![lstfiles]. I don't know if that's the source of the
specific error you're getting or not, but try this:
'----- start of revised code -----
Public Sub alex()
Dim strlist As String
With Forms![frmUpload]![lstfiles]
For Each varItem In .ItemsSelected
strlist = strlist & ";" & .Column(1, varItem)
Next varItem
End With
Forms![frmUpload]![lstSelected].RowSource = Mid(strlist, 2)
End Sub
'----- end of revised code -----
I notice you also didn't have a Dim statement for strlist. That
suggests, though it doesn't prove, that you don't have the VB Editor
option "Require Variable Declaration" checked. You should -- requiring
all variables to be declared will save you no end of grief in the long
run.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)