Solved Up and Down Buttons to Change Sequence (1 Viewer)

MattBaldry

Self Taught, Learn from the Forums
Local time
Today, 10:08
Joined
Feb 5, 2019
Messages
299
Hi all,

Does anyone have a sample code of Up and Down buttons to change the sequence of a list?

I have a table with a field [Sequence] which I will use to sort the order. It does not allow duplicates.

What I am after is a code for buttons so when an item is highlighted, if I click Up, it changes the Sequence field from 10 to 9, and this would then need to change the current 9 to 10, if that makes sense.

~Matt
 

Gasman

Enthusiastic Amateur
Local time
Today, 10:08
Joined
Sep 21, 2011
Messages
14,446
Pretty sure @MajP had a class to do just that?
Search with his username.

Then again, there is Google

However his code would be a lot easier and cleaner. :)
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 17:08
Joined
May 7, 2009
Messages
19,246
i also have a demo for Bound Listbox.
 

Attachments

  • BoundListboxMoveUpDown.accdb
    576 KB · Views: 93

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:08
Joined
May 21, 2018
Messages
8,605
This has a lot of features. Also has features to support doing something with the sorted list.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 05:08
Joined
Feb 19, 2002
Messages
43,478
I do it differently. When the lists get long, it is too easy to get lost when you use the drag and drop method. Look at the subform example. The sequence numbers are inserted either by 10's or 100's, I don't remember which and you can change it to leave whatever gaps make sense to you. Then, you can replace #500 with #150 to move it to between #100 and #200 without having to try to drag it there. When you run out of gaps or are finished, you can renumber the sequence to make it "neat" again:)

 

Gasman

Enthusiastic Amateur
Local time
Today, 10:08
Joined
Sep 21, 2011
Messages
14,446
This looks perfect, but the download link does not work :(

~Matt
Just copy the link then? :(
This will take you to all the zip files


Look at the link on the page posted to see what zip file you need.
It downloaded fine for me, it opens and extracts fine, and the demo is as indicated.
 

MattBaldry

Self Taught, Learn from the Forums
Local time
Today, 10:08
Joined
Feb 5, 2019
Messages
299
Just copy the link then? :(
This will take you to all the zip files


Look at the link on the page posted to see what zip file you need.
It downloaded fine for me, it opens and extracts fine, and the demo is as indicated.
I tried that but it didn't work. But now it does. Possibly my browser playing up....

~Matt
 

Gasman

Enthusiastic Amateur
Local time
Today, 10:08
Joined
Sep 21, 2011
Messages
14,446
Gina, the here link links to the zip file, but appears to do nothing?
 

MattBaldry

Self Taught, Learn from the Forums
Local time
Today, 10:08
Joined
Feb 5, 2019
Messages
299
Never mind, I got it and fixed it... and looks like I have quite a few links to fix so thanks for letting me know.
Thanks Gina,

And the download is exactly what I was after, so just need to integrate it into my form now.

~Matt
 

MattBaldry

Self Taught, Learn from the Forums
Local time
Today, 10:08
Joined
Feb 5, 2019
Messages
299
Never mind, I got it and fixed it... and looks like I have quite a few links to fix so thanks for letting me know.
Thank you Gina,

It works perfectly, and the code was easy to read and learn.

ListBox.png


Thank you for your help.

~Matt
 

Users who are viewing this thread

Top Bottom