Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2002
    Posts
    21

    Unanswered: List box question

    Does the list box control in Access support the RemoveItem method? The following code gives me a "Method or data member not found" error and the RemoveItem identifier is hilighted. If it doesn't support the RemoveItem method, how can I remove a particular list box item?

    Code:
    Private Sub btnRemoveFromHotList_Click()
        Dim itemIndex As Integer
    
        itemIndex = 0
    
        Do While itemIndex < lbJobIDHotList.ListCount
            If lbJobIDHotList.Selected(itemIndex) Then
                DoCmd.RunSQL "Delete JobID " & _
                            "FROM PunchListHotList " & _
                            "WHERE JobID = " & "'" & lbJobIDHotList.ItemsSelected (itemIndex) & "'"
                lbJobIDHotList.RemoveItem itemIndex
            End If
            itemIndex = itemIndex + 1
        Loop
    End Sub
    tia,
    flynn

  2. #2
    Join Date
    Nov 2001
    Posts
    336
    Hi,

    Try:

    lbJobIDHotList.Requery

    Igor

  3. #3
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    91
    If you are using Table/Query, delete from table and requery the list box.
    If you are using Value List, just manipulate the string of RowSource. I think the RemoveItem is available on Access XP.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •