How do users de-select listbox item in ACCESS, single-choice list

G

Guest

I have an ACCESS Form with a single-choice list box control. It is OK for a
user to select NOTHING from this list. But, if they select an item, and then
want to clear their selection to nothing, how do they de-select an item? This
is not a multiple-choice list.
 
A

Albert D. Kallal

Hum, you kind of got a good question!

I never had this problem..but suspect you might have to put a "clear" button
below the list box....

The code could be:


me.Mylistbox = null
 
D

Douglas J. Steele

I've never been able to come up with any other solution than that, Albert.
 
C

Carl Rapson

In addition to what Albert and Douglas described, another option might be to
add a "None" item to the list. I've done that a few times (to be honest, I
didn't think of using a check box to clear), and it doesn't seem to confuse
the users. I just use:

Carl Rapson
 
S

Stephen Lebans

(slow night tonight)
I accept your challenge sir!


Private Sub lstSelectACustomer_Click()
Static lListIndex As Long

If lListIndex = Me.lstSelectACustomer.ListIndex Then
Me.lstSelectACustomer = Null
lListIndex = -1
Else
' do nothing...new selection
lListIndex = Me.lstSelectACustomer.ListIndex
End If

End Sub


--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 

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