Order items in a listbox

  • Thread starter Thread starter McKeown NewsGroup Account
  • Start date Start date
M

McKeown NewsGroup Account

Hi

Been reading "Access 2000 Bible" by Prague and Irwin and they had some
really interesting techniques on using two listboxes to select multiple
items as part of Prague's "25 Cool Control Tricks".

What I was interested in was:

How to order / sequence these items after you have them selected in the
second listbox. Searched the web but haven't found what I'm after.

Any ideas where I could look?

Thanks

Leonard
 
Only somebody with that book's going to be able to help
you since there's no way of knowing EXACTLY what they're
doing. Tell us what and how the controls are working and
maybe someone can help.

One possibility would be to:

1) Populate a dedicated table with the selected data from
the first List as it is selected,
2) Create a query (based on the dedicated table) that
sequences the data the way you want it,
3) Base the second list on the sequencing query,
4) Requery the second list during the OnUpdate property of
the first list,
5) Delete the table data after it is no longer needed.
 
Hi Dan

Yeah, I didn't make myself very clear.

After you have selected an item from listbox1, pressed the arrow cmd button,
it appears in listbox2. You select three items this way. Then you click on
the middle item in listbox2 and click the up arrow cmd button and this item
is now at the top of the list. You often see this in Microsoft wizards for
form and report creation in Access.

How you do it, is what I was wondering.

Leonard
 
How is Listbox2 filled? The items don't just "appear" in Listbox2 ...
apparently, your button runs code which pushes them into Listbox2. we need
to see the code which does this (which is probably the code behind the Click
event of the "arrow cmd button").
 
If you are using two tables, or one table with a "id" that sets the combo
box to display in either side, then all you have to do is:

me.YouComboBox.Requery

You then just make sure that the sql used for the two lists boxes has the
order set.
 
Thanks for the replies.

What I was trying to get at was:

move items in a list box up and down- change their order.

There is plenty of code on this in vb on the web but not in vba.

Leonard
 
Back
Top