[AccessD] listbox question

Steve Capistrant scapistrant at symphonyinfo.com
Fri Sep 5 08:03:57 CDT 2003


Call this public function from any form that has a list box.  It can be used
to SELECT ALL or UNSELECT ALL items.
----------------

Public Function FillClearListBox(ctlList As Control, bytAction As Byte) As
Boolean
'Selects or Deselects all items in list box
Arguments:
    'ctlList: the fully articulated name of the listbox (e.g.
Forms!frmMyForm!lstMyList)
    'bytAction: The type of action desired; 1=Select All, 2=Unselect All

On Error GoTo eh

    Dim intItem As Integer

'Loop through each item on list and either select or deselect it.
    For intItem = 0 To ctlList.ListCount - 1
        Select Case bytAction
            Case 1:  ctlList.Selected(intItem) = True
            Case 2:  ctlList.Selected(intItem) = False
        End Select
    Next

ex:
    Set ctlList = Nothing
    Exit Function
eh:
    MsgBox Err.Description
    GoTo ex
End Function
--------------------------

Steve Capistrant
Symphony Information Services
scapistrant at symphonyinfo.com
Phone: 612-333-1311
www.symphonyinfo.com
212 3rd Ave N, Ste 404
Minneapolis, MN 55401


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Dale Kalsow
Sent: Friday, September 05, 2003 7:41 AM
To: accessd at databaseadvisors.com
Subject: [AccessD] listbox question


Ok,  I know this should be easy but I am still having a problem with it.
Does any know how to select all of the items in a listbox?

Thanks!

Dale


----------------------------------------------------------------------------
----
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030905/0cc194d5/attachment-0001.html>


More information about the AccessD mailing list