Link to home
Start Free TrialLog in
Avatar of stephenlecomptejr
stephenlecomptejrFlag for United States of America

asked on

How to make listbox move items up- down with a click of a button using Access VBA?

I'm posting the following sample to demonstrate my need for making a an Access listbox controlled by buttons - where once an item is selected it can move that item above another in the list - same when selecting down.  There are other concerns - obviously but I think I got the delete down - and move to the end/top...  Is there something I'm missing to make this happen - is there a property I'm not seeing that does this already?


https://filedb.experts-exchange.com/incoming/ee-stuff/8156-sample-listbox.mdb
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image


How about a Drop and Drag solution instead:

http://www.peterssoftware.com/dd.htm

Among other VERY cool things >> "Re-order list box items with drag and drop"

I own this product and have used the list box DnD in a couple of apps ...

Just a thought ...

mx
Avatar of stephenlecomptejr

ASKER

Naw but thanks though...
ASKER CERTIFIED SOLUTION
Avatar of als315
als315
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That's what I wanted for now.

Later I'll post a more in depth sample with some more detailed questions....
This is one bug.  If you move an item all the way to the Top, the Move To Bottom does not work.

In fact, the item does not necessarily have to be at the Top.

Also, I saw a case where the Up One moves up two or more.

And the Move Down One also has issues ... gets stuck sometimes ...

Just an fyi ...

mx
Thanks, Joe.
First error was corrected. I can't reproduce other errors.

sample-listbox.mdb
I promise ... they are there ... just keep clicking :-)