Solved

Invert List Box Selection

Posted on 2013-05-23
1
504 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
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now