unselect item in single-select listbox

B

bf1

Hi-
I'm using Acces 2000. I have a listbox populated with values from a
lookup table. (It is part of a form with many other text and
listboxes.) Multiselect is set to None.

As they are navigating through the whole form, the user is allowed to
choose one item from this listbox, but may opt to not select any item.
My stumbling block is that once a user selects an item, and then
decides that they don't want to choose that or any other item from the
listbox, I would like them to be able to unselect the item by clicking
on it again. Is it standard behavior for a non-multiselect listbox
to not be able to unselect an item by clicking on it? If so, what is
the best approach to take to get the user to be able to toggle an item
from this listbox on and off? I could create a "clear" button for just
that listbox, but this seems clumsy (at least, my user will demand to
know why he can't just click on the selected item to unselect it).
But if a "clear" button is the only way to go, so be it. Or should I
add a null row to the listbox and make the user choose that to unselect
an item? This seems less desirable than the "clear" button.

I have searched high and low in the newsgroup, but I must be searching
with the wrong words. This seems like a popular thing to want to do,
but I can't find other posts that fit my situation, so I apologize in
advance if this has been asked and answered many times before.

TIA,
Beth F.
 
M

Marshall Barton

I'm using Acces 2000. I have a listbox populated with values from a
lookup table. (It is part of a form with many other text and
listboxes.) Multiselect is set to None.

As they are navigating through the whole form, the user is allowed to
choose one item from this listbox, but may opt to not select any item.
My stumbling block is that once a user selects an item, and then
decides that they don't want to choose that or any other item from the
listbox, I would like them to be able to unselect the item by clicking
on it again. Is it standard behavior for a non-multiselect listbox
to not be able to unselect an item by clicking on it? If so, what is
the best approach to take to get the user to be able to toggle an item
from this listbox on and off? I could create a "clear" button for just
that listbox, but this seems clumsy (at least, my user will demand to
know why he can't just click on the selected item to unselect it).
But if a "clear" button is the only way to go, so be it. Or should I
add a null row to the listbox and make the user choose that to unselect
an item? This seems less desirable than the "clear" button.

I have searched high and low in the newsgroup, but I must be searching
with the wrong words. This seems like a popular thing to want to do,
but I can't find other posts that fit my situation, so I apologize in
advance if this has been asked and answered many times before.


If you use a button, just set the combo box's Value to Null.

OTOH, I just tell users to use the Delete key to remove the
unwanted data,
 
B

bf1

Thanks for the response. I am confused when you say you tell the users
to use the delete key; that does not seem to do the trick for my
listbox. I select (click on) one of the values, but then hitting the
delete key does not UNselect it for me. Is this how a listbox with
multiselect = None should work?
I'm thinking my only option is to add a "clear" button and deal with
the user's displeasure.

Thanks,
Beth F.
 
M

Marshall Barton

I guess I was having a bad day. I was reading combo box
where you said list box.

An alternative to a button that you may or may not like is
to use the list box's DoubleClick event to set the list
box's value to Null.
 
B

bf1

No problem.
I like the DoubleClick idea. I will ask the user if he would prefer
DoubleClick, or a Clear button.

Thank you for the alternatives-
Beth F.

Marshall said:
I guess I was having a bad day. I was reading combo box
where you said list box.

An alternative to a button that you may or may not like is
to use the list box's DoubleClick event to set the list
box's value to Null.
--
Marsh
MVP [MS Access]


Thanks for the response. I am confused when you say you tell the users
to use the delete key; that does not seem to do the trick for my
listbox. I select (click on) one of the values, but then hitting the
delete key does not UNselect it for me. Is this how a listbox with
multiselect = None should work?
I'm thinking my only option is to add a "clear" button and deal with
the user's displeasure
 

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