We help IT Professionals succeed at work.

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

stephenlecomptejr
on
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
Comment
Watch Question

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
CERTIFIED EXPERT
Top Expert 2007

Commented:

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

Author

Commented:
Naw but thanks though...
CERTIFIED EXPERT
Commented:
See example sample-listbox.mdb

Author

Commented:
That's what I wanted for now.

Later I'll post a more in depth sample with some more detailed questions....
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
CERTIFIED EXPERT
Top Expert 2007

Commented:
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
CERTIFIED EXPERT

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

sample-listbox.mdb
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
CERTIFIED EXPERT
Top Expert 2007

Commented:
I promise ... they are there ... just keep clicking :-)