MultiSelect Misbehavin'

  • Thread starter Thread starter Pat Whitted
  • Start date Start date
P

Pat Whitted

In Access 2003, developing on an XP Pro platform, I have created a form with
an extended multiselect listbox. The listbox has OnClick and OnDoubleClick
events. Recently (which I specify because this used to work properly),
whenever I attempt to actually multi-select (either with SHIFT-Click or with
CTRL-Click) the rows selected *flash* as highlighted, then the control
resets to nothing selected. I don't recall having made any other changes to
the form or to the code behind the Click events between when it last worked,
and when it started misbehavin'. BTW - no changes to my platform or to
Access config, either. Any clues as to what could be going on? TIAFAH! - Pat
 
Have you tried Simple multiselect, just to see what will happen? Have you
tried deleting the control and creating a new one to see if the current one
has become corrupted?
 
Yep, I added a new control, duplicated everything about the original one -
same result.

I changed the listbox to Simple, and it performs/behaves as expected.
Interestingly, if I drag the mouse to select multiple items, then the
Extended multi-select works properly. But if I select 1 item, then use SHIFT
or CTRL to select subsequent items, I get the behavior described previously.

Also, while running these tests I have observed that a "CLEAR" button I have
on the form does not work on the listbox control when I have multiple items
selected. With a single item selected, it becomes deselected, but with more
than one, they remain selected. My CLEAR button both sets the value of the
control to NULL, and does .Undo. Any idea why this is, and/or how to
remedy? - Pat
 
There have been some bugs, such as what you mention, in the Extended Select
listboxes. To unselect everything in the listbox, it is easiest to just loop
through all of the items and set the selected property to False.

Example:
Dim I As Integer
If lstMembers.ListCount = 0 Then Exit Sub
For I = 0 To lstMembers.ListCount - 1
lstMembers.Selected(I) = False
Next I
 
Thanks again, Wayne! Actually, i found the bug - in MY code! For some reason
that escapes me now, I had entered Me.lbxMyListBox = NULL in the section of
code that deals with what to do when more than one row is selected. DOH!
Thanks for the tip on clearing the listbox - works like a champ! - Pat
 
Back
Top