Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Unanswered: Listbox "unselect" items in Access 2000

    Hi all.

    Jut being a bit lazy here ... I have an extended select ListBox that after making my selections and performing my processing I need to clear the remaining selected rows ... Any ideas? Thanks.

    - Mike

  2. #2
    Join Date
    Nov 2003
    Location
    Warren, PA
    Posts
    52
    List0.Requery


    Brent

  3. #3
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Brent,

    NOPE! Nice try tho ...

    I did some poking around and came up with:

    Code:
    Private Sub RemoveWOButton_Click()
        If AllocList.ItemsSelected.Count < 1 Then Exit Sub
        
        Dim i As Long, ItemCount As Integer, BDRow As Variant, SelArray() As Integer
        
        i = 1
        ItemCount = AllocList.ItemsSelected.Count
        ReDim SelArray(AllocList.ItemsSelected.Count)
        For Each BDRow In AllocList.ItemsSelected
            AllocList.Selected(BDRow) = False
            AvailableQty = AvailableQty + CDbl(AllocList.Column(1, BDRow))
            SQLString = "UPDATE " & WO_Tbl & " SET IsVisible=True WHERE (WorkOrderNumber='" & AllocList.Column(0, BDRow) & "');"
            DoCmd.SetWarnings False
            DoCmd.RunSQL SQLString, False
            SelArray(i) = BDRow
            i = i + 1
        Next BDRow
        AvailQtyLbl.Caption = AvailableQty
        
    '    For i = AllocList.ItemsSelected.Count To 1 Step -1
        For i = ItemCount To 1 Step -1
            SQLString = "DELETE FROM " & AllocListTbl & " WHERE (WorkOrderNumber='" & AllocList.Column(0, SelArray(i)) & "');"
            DoCmd.SetWarnings False
            DoCmd.RunSQL SQLString, False
        Next
        
        AssignToQtyTxt.Value = ""
        WO_ComboBox.Value = ""
        
        WO_ComboBox.Requery
        AllocList.Requery
        AssignToQtyTxt.SetFocus
    End Sub
    The pertinent part is when I iterate thru the list saving off the indices I reset the Selected flag of the list row ... BINGO!

    - Mike

  4. #4
    Join Date
    Nov 2003
    Posts
    1,487
    Thats a keeper....thanks M Owen

Posting Permissions

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