Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    PoorBoy is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Feb 2013
    Posts
    14

    remove multiple selected items from listbox


    hi im new, i want to remove multiple selected items from listbox when i click remove button. but my listbox type is query/table ,Multi select is simple.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Depends on purpose of this listbox. What happens when items are selected? Are they saved into records?
    Last edited by June7; 07-18-2013 at 04:52 PM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    Do you mean that you want to actually remove all selected items, i.e. have them no longer appear in the Listbox?

    Or do you mean that you want all selected items, in the Listbox, de-selected?

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    PoorBoy is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Feb 2013
    Posts
    14
    yes remove all selected items, and does no longer appear in the listbox

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    This requires filtering the query that is the RowSource.

    What is purpose of the listbox? Why would you want to remove items from the RowSource?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    PoorBoy is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Feb 2013
    Posts
    14
    ok, i have a filter form, after i filter a list of people, it will display on the listbox1.
    Then i have a add button to pass the a list of people to another listbox2.And i want to put in
    remove button to remove select people from the listbox

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    If listbox 1 has a query as RowSource, then will need code that alters the RowSource with filter criteria that is the values in listbox 2. Review: http://www.msofficegurus.com/post/Ac...box-Items.aspx
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    PoorBoy is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Feb 2013
    Posts
    14
    im sry, im new . my listbox are in different form not in same form. i only want to remove the selected item, make it not display on the listbox. listbox1 remove selected item make it not display on the listbox

    i have this code that remove all item, but i wan only remove selected item.

    me.listbox1.rowsource = "SELECT table.field FROM table " & _ "WHERE table.field <> forms!formname!listbox1.column(#)"
    me.listbox1.requery

  9. #9
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Doesn't matter if the listboxes are in different forms, the issue is the same and the example code addresses it. Since I don't understand why you are doing this, hard to offer solutions.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  10. #10
    PoorBoy is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Feb 2013
    Posts
    14
    i have upload my form. How do i remove selected item from the listbox .

    Remove selected.zip
    Last edited by PoorBoy; 07-24-2013 at 08:13 AM. Reason: error

  11. #11
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Before I bother with download, have you attempted the referenced code?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  12. #12
    PoorBoy is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Feb 2013
    Posts
    14
    i have tried the referenced code, as im new to msaccess. im not able to understand some of the code

  13. #13
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    The db has one table and one form. When I opened the form got error message that tblVolunteers was missing.

    The example code is not in this db. This does not show me any attempt was made to incorporate.

    If you want help, make it easy for us to help. I do not want to make effort to build a db to run and test code.

    What is purpose of the listboxes?

    If you want to perform sophisticated complex opertions in db, need to learn programming. Start with a review of http://office.microsoft.com/en-us/ac...010341717.aspx
    Last edited by June7; 07-27-2013 at 10:39 PM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  14. #14
    PoorBoy is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Feb 2013
    Posts
    14
    im sry, the purpose of the listbox is to show the list of volunteers after filtering.
    i have changed the form design ,the example u give is not the same.
    i copy the the table and form from my database to a new database.i forgot to included tblvolunteers
    removeselectedv2.accdb

  15. #15
    taino is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2020
    Posts
    3
    Hi,
    I need help to delete items from listbox,
    I have two listbox, now I have code to pass value from lstbox1 to lstbox2 but now I would likewen I copy items from ltsbox1 to lstbox2 this items delete from lst1. Is important note that my lst have 3 columns


    Thanks for your help

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 10-23-2012, 03:32 PM
  2. Replies: 18
    Last Post: 01-27-2012, 12:53 PM
  3. Deleting multiple records selected in a Listbox
    By ankitmehtta in forum Access
    Replies: 4
    Last Post: 11-08-2011, 01:20 PM
  4. Replies: 2
    Last Post: 07-10-2011, 07:22 PM
  5. Selected items in listbox
    By tomodachi in forum Access
    Replies: 1
    Last Post: 09-09-2010, 01:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums