Hi all
I collected the list of items selected in a listbox into a collection.and i need to perfrm some operation on those selected items.
so on click of Ok (after selecting the items on the lis on UI), I need to take the ctrl to the function.
in the function i will have to browse thru the collection of selected items and get a ceratin property of the individual items in it.

but wen i do this, i get a runtime error 424 under the function; on the line where i browse the collection.

is it becos the actual item is needed fro getting a property of it & that item is not getting collected, just the name is getting collected in the collection??????????

wats the wrkaround for this?..can anyone hellp me?

this is the form:

Private Sub setperm_Click()
Dim saveMousePointer As Integer 
Dim mode As ERUAccessMode
Dim selitm As New Collection
Dim newScope As ERUAccessScope
Dim MsgRet As VbMsgBoxResult

               
    If lstCont.SelCount = 0 Then
        MsgBox "Please pick item/items first."
        Exit Sub
     Else
        MsgRet = MsgBox("Are you sure you want change Access Control of " & (lstCont.SelCount) & " Items?", vbYesNo)
    
       If MsgRet = vbYes Then
         For i = lstCont.ListCount - 1 To 0 Step -1
          If lstCont.Selected(i) = True Then
           selitm.Add (lstCont.List(i))
            Set itempath = lstCont.List(i)
            MsgBox lstCont.List(i)
          End If
         Next i
        
        ShowWait True, saveMousePointer 'declared in another module
            PermChange selitm, mode, newScope
            'success, no error
          MsgBox ("Permissions set successfully!")
          Unload Me
       End If
  End If

End Sub

This is the module containing the Function PermChange:

Function PermChange(selitm As Collection, mode As ERUAccessMode, newScope As ERUAccessScope)


    Dim a As Integer
    Dim itms As IERUItem
    Dim mem As IERUMember
    Dim ac As IERUAccessControl
    Dim acList As IERUCollection
    Dim bTurnOnReadOnly As Boolean

    'remind ourselves at the end of the function to turn on readonly again.
    bTurnOnReadOnly = False
      
    
    'Get the access control object for the item selected in lstCont
    For a = 1 To selitm.Count
     For Each itms In selitm.item(a)        Set ac = itms.AccessControl
     Next itms
    Next a
    If ac.IsReadOnly Then
    'Must turn off readonly, before we can modify access control.
        ac.IsReadOnly = False
        bTurnOnReadOnly = True
    End If
        
    If newScope = erScopeList Then
        'GetAccessScope returns scope of edit/open list depending on mode.
        If ac.GetAccessScope(mode) = erScopeList Then
         Set acList = ac.GetAccessList(erMemFlagNone, mode)
         
         MsgBox ("done!")
        
    
    
    End If
End If
    
End Function

I get Runtime error 424 object required at the red line under the func.
can any1 help pls?

This article has been dead for over six months. Start a new discussion instead.