displayed item is selected item in list box

M

MNJoe

I have a lsit box "Resource_Selection_List" that I have created. I have it
populated correctly with all the resources from the DB. I have the Default
set to the first item in the list "ALT". I have it set so they can only see
one item at a time and can only select one item. When a user clicks on the up
and down arrows on the list box, Is there a way determine which item (index
number) they are looking at so when they click on the start button I know
which item is displayed. They are not actually clicking on the item a lot of
the times and it is defaulting to the first item. Trying to idiot prof this a
little more.

Thanks
 
M

MNJoe

The list box's ListIndex property should provide the number
of the selected item.

The problem is they are not clicking on the item in the window. When I do my
test and move the selection done 3 or 4 and click on the start button. I
output a MSGBOX with the listindex and it is always -1. Never thought about
using a combo box. I will try this and see if it solves the problem.

Thanks
 
K

Klatuu

The ListIndex property has nothing to do with whether an item is selected or
not. It is just a reference to a row in the list.
What you would have to do is have an interger or long variable to increment
and decrement and you move up and down the list so you know which row you are
on.

But, as Marsh said, a combo box would be a much better control for this
situation.
 
M

MNJoe

I think I will change to the combo box but, Just for my knowledge, What
property/parameter would I be able to check when they click on the arrows to
move up or down so I can create a variable to keep track. I found one web
site where there is a lot of coding used (Some API amongst other coding) to
check where the control is at. I am pretty sure it works but, This looks very
in depth coding. I was hoping there was something a little easier. I have
done a bit of VB6 programming and a few other languages. I am just getting
into Access for the last 2 months.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top