silentwolf
Well-known Member
- Joined
- May 14, 2008
- Messages
- 1,216
- Office Version
- 2016
Hi guys I got a multiselect listbox in a access userform
I found the ItemsSelected but it is not really working what do I need to change here?
Could someone let me please know?
Found for each loop to got through more selected Items but is there a way of doing it in the code above?
Thanks for advice!
Albert
Code:
Private Sub btnOeffnen_Click()
Dim rcsObj As Recordset
Dim lItem As Long
For lItem = 0 To lstMitarbeiter.ListCount - 1
If lstMitarbeiter.Selected(lItem) = True Then
Set rcsObj = CurrentDb.OpenRecordset("tblStundenTest", dbOpenDynaset)
With rcsObj
.AddNew
.Fields("stdDatum").Value = Me.txtDatum
.Fields("stdAnfang").Value = Me.txtStart
.Fields("stdEnde").Value = Me.txtEnde
[COLOR=#ff0000].Fields("stdMitIDRef").Value = Me.lstMitarbeiter.ItemsSelected[/COLOR]
.Fields("stdObjIDRef").Value = Me.lstObjekte
rcsObj.Update
End With
lstMitarbeiter.Selected(lItem) = False
End If
Next lItem
End Sub
I found the ItemsSelected but it is not really working what do I need to change here?
Could someone let me please know?
Found for each loop to got through more selected Items but is there a way of doing it in the code above?
Thanks for advice!
Albert