[AccessD] List box populated with data and *nothing* selected

Collins, Darryl Darryl.Collins at anz.com
Mon Jan 4 17:31:37 CST 2010


Outstanding... Thanks a lot for this, and for everyone else whom added
their thoughts.

Regards
Darryl. 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of A.D. Tejpal
Sent: Monday, 4 January 2010 8:13 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] List box populated with data and *nothing*
selected

Darryl,

    As already suggested in this thread, setting the list box value to
Null or its ListIndex to an unlikely value (say -1) should normally
serve the purpose.

    However, it is occasionally observed that shadow of previous
selection tends to persist (specially in multi-select scenario) after
the list box has been re-populated as per revised criteria. Even
non-existent rows might appear in selected state (i.e. the area where
proper selection was in force earlier). 

    In order to forestall such behavior and as an abundant precaution,
de-selection by iteration through list rows could be adopted as per
sample routine P_ClearListBox(), as given below. Pointer to list box
object is passed as an argument.

Best wishes,
A.D. Tejpal
------------

' Sample routine for absolute clearing of list box
'============================== Private Sub P_ClearListBox(lbo As
ListBox)
    Dim Cnt As Long

    For Cnt = 0 To lbo.ListCount - 1
        lbo.Selected(Cnt) = False
    Next
End Sub
'==============================

  ----- Original Message -----
  From: Collins, Darryl
  To: Access Developers discussion and problem solving
  Sent: Monday, January 04, 2010 10:05
  Subject: [AccessD] List box populated with data and *nothing* selected


  Hi Folks,

  I am guessing not a lot of us are lurking, but here goes....

  I have a form with a list box.  When the form opens and the list box
is
  initially populated, there is no record selected in the list.  This is
a
  good thing for me and how I want things to work.

  When the user chooses an option in the list, it will return a record
set
  of filtered data in a different subform based on their choice.  All
this
  works swimmingly well.

  What I would like is a way to return the listbox to a neutral state
when
  the users click on a reset option (which will return *all* records in
  the other subform).

  Currently the reset process works perfectly on a technical level, but
on
  a visual level one of the list box options is always left still
  highlighted, which suggests that the filter is still applied on the
  highlighted record.

  I know I could use a combo box for this sort of thing (I often do),
but
  I like the point and click simplicity of the list box approach for
this
  form.

  Clearly Access is happy to have the list box exist with nothing
selected
  as this is the default position whenever the base form is opened,
  however how does one return/reset it to that state? A list box
populated
  with data and *nothing* selected?

  Cheers
  Darryl.
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

"This e-mail and any attachments to it (the "Communication") is, unless otherwise stated, confidential,  may contain copyright material and is for the use only of the intended recipient. If you receive the Communication in error, please notify the sender immediately by return e-mail, delete the Communication and the return e-mail, and do not read, copy, retransmit or otherwise deal with it. Any views expressed in the Communication are those of the individual sender only, unless expressly stated to be those of Australia and New Zealand Banking Group Limited ABN 11 005 357 522, or any of its related entities including ANZ National Bank Limited (together "ANZ"). ANZ does not accept liability in connection with the integrity of or errors in the Communication, computer virus, data corruption, interference or delay arising from or in respect of the Communication."




More information about the AccessD mailing list