Can't deselect item in non-multi-select listbox?

Then you never had a single column to begin with. Have we moved on to a new problem since this is not the solution to the problem you came here with?

Sorry, yes... I guess so, yes.

My original problem was providing an intuitive method to allow users to deselect an item in a listbox. As I explored options, I discovered that a continuous subform, as an alternative to the listbox, would solve a different set of problems that arose (nothing to do with item selection).

But it so transpired that it also solved this problem because I could control / manipulate the selection behaviour in the subform, more easily than with the listbox. So, yes, you are correct, apologies for the crossed wires there! :oops:
 
My original problem was providing an intuitive method to allow users to deselect an item in a listbox
It would have been a neat way to check for a pressed special key (Ctrl, Alt, Shift) on the click event and then assign zero to the list field.
 
It would have been a neat way to check for a pressed special key (Ctrl, Alt, Shift) on the click event and then assign zero to the list field.

Yes, see post #5 in this thread (pretty much what you're describing)
 
Code:
Private Declare Function GetKeyState% Lib "user32" (ByVal vkey As Long)

Private Sub MyListBox_Click()
   If Abs(GetKeyState(17) < 0) Then                  ' CTRL+
      Me.MyListBox = NULL
   End If
End Sub
 
There is one more option that I think is not exposed and that is to place it as the first row (Select a row) and this first row deselects all the others but will not be taken into account.
Or also say "unselect here"
Nothing out of this world but it is an option
 
Why would that be normal behaviour by design I wonder?
To make it work more like a textbox. There is no "undo" for the text box either but exc will clear the last entered value. Esc, esc will clear all updates to the form that have not been committed.
 

Users who are viewing this thread

Back
Top Bottom