(List Box) This probably can't be done, but..

  • Thread starter Thread starter Robin
  • Start date Start date
R

Robin

Is there any way to populate a list box from the bottom up? I'm in Access
2002 but can use 2003.
 
Hi Robin,

You can't do this "out-of-the-box" in any version of Access. But, as I
sometimes say, if you're bloody-minded enough you can do anything. So, you
could try the following:
Write a query that generates the desired content for the listbox, and
includes a blank field.
Fill the listbox from this query, displaying the blank field and
including the desired field in a non-visible column.
Write code to loop backwards through the listbox items from the listbox
itemcount to 1, and swap the hidden column value into the displayed column
value.

But why would you want to do this?

Rob
 
But why would you want to do this?

that was my question too, Rob....but i have to tell you, i like your
"bloody-minded" saying! <g>
 
Hi Rob,

Thank you for your response. I'm not sure I fully understand your solution,
but the why is this: I'm trying to do a visual representation of an "Inbox".
(Using a transparent list box sitting atop an inbox cutaway looking thing
made with simple lines on the form.) Using the "drag-and-drop" coding I
found referenced on this website, I am trying to allow admin to drag from a
"pile" of unassigned items to various staffers inboxes. Further, if a staff
got behind, assignments could be dragged to another's not so full inbox.
(There is A LOT of reassigning that goes on here.) I know there are other
ways to show this with just plain list boxes, summed budgeted hours, etc.,
but this place needs the "simplicity" (and the head partner said, "Hey it'd
be cool if we could just...")

The only way I've imagined it could be done would be to populate the listbox
from a query sorted on an assignment date (newest to oldest) and have the
list box grow or shrink through code (using the height property) upon each
assignment move. Additionally the StaffID field in each assignment record
will have to be updated upon each drag-and-drop. And I'm not even sure you
can drag-and-drop from a query based list box. I guess I need to work on
this some more. To tell the truth though, this type of thing is why I
actually enjoy doing this. I'm not a developer but just come up with
solutions where I work.

Thanks again, Robin
 
It took me a few to figure the code out but I think it will work. If I'm
reading the code right, it looks like your telling it in which row to place
the data which I could have code calculate based on number of rows already
existing (to place the new value on top). I also believe I could work this
function into the drag-and-drop code.

I'll give it a try. Thanks!
 
The only way I've imagined it could be done would be to populate the
listbox
from a query sorted on an assignment date (newest to oldest)

i'm trying to visualize your setup, and perhaps i'm missing something. if
your question about "populating from the bottom up" is just a matter of sort
order, have you tried setting the sort order in the query or SQL statement
used as the RowSource of the listbox control?

hth
 
Tina,

No, it's not just a matter of sort order. When I put the list box "in the
inbox" and have the list box tall enough to hold about 50 or more
assignments, if the list box is not full, the assignment appear to be
"floating" above the inbox. With just a few assignments in an inbox, you
don't even notice the relationship between the list and the inbox.

Assingment1
Assignment2







_____________
INBOX
===========
 
And I'm not even sure you
candrag-and-dropfrom a query based list box. I guess I need to work on
this some more.

Access has nothing built-in to allow dragging and dropping between
listboxes. There are some third-party tools that may help:

A shareware version of a product I created called Drag-N-Dropper for
Microsoft Access is available at this web site: http://www.peterssoftware.com/dd.htm

Stephen Lebans has an example of a FieldList control that supports
drag and drop: http://www.lebans.com/vb_listbox.htm

The Forms Sample database provided by Microsoft has an example called
"Simulating Drag-And-Drop Capabilities". You can download the sample
database here: http://support.microsoft.com/default.aspx?scid=kb;EN-US;175066

Hope this helps,
 
Back
Top