Solved

Invert List Box Selection

Posted on 2013-05-23
1
558 Views
Last Modified: 2013-05-23
Hi,

I have a MS Access form with a multiselect list box.

I want to programatically invert the selection, ie, iterate through all the entries in the listbox and turn off the ones that are selected and turn on the ones that are not selected.

How can I achieve this please?
0
Comment
Question by:rowansmith
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 39190235
Try looping through the listbox, toggling the Selected property of each item:

    Dim i As Integer
    
    For i = 0 To (Me.YourListBox.ListCount - 1)
        Me.YourListBox.Selected(i) = Not Me.YourListBox.Selected(i)
    Next i

Open in new window

0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question