[AccessD] listbox question

Griffiths, Richard R.Griffiths at bury.gov.uk
Fri Sep 5 08:39:43 CDT 2003


Hi

a slightly faster version (if you have many items) would be to do away with
the select case statement and pass into the function true or false so you
would get :
for..
	ctlList.Selected(intItem) = boolParameter
loop

or even

for..
	if ctlList.Selected(intItem) <> boolParameter then
	ctlList.Selected(intItem) = boolParameter
	endif
loop

on the premise that testing an property is quicker than updating a property.

(No doubt the are even more efficient methods that these)

Richard

> -----Original Message-----
> From:	Dale Kalsow [SMTP:dkalsow at yahoo.com]
> Sent:	05 September 2003 14:20
> To:	Access Developers discussion and problem solving
> Subject:	RE: [AccessD] listbox question
> 
> works great! - Thanks!
> 
> Steve Capistrant <scapistrant at symphonyinfo.com> wrote: 
> 
> 	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
> <http://us.rd.yahoo.com/evt=10469/*http://sitebuilder.yahoo.com> - Free,
> easy-to-use web site design software
> _______________________________________________
> 	AccessD mailing list
> 	AccessD at databaseadvisors.com
> 	http://databaseadvisors.com/mailman/listinfo/accessd
> 	Website: http://www.databaseadvisors.com
> 	
> 
>   _____  
> 
> Do you Yahoo!?
> Yahoo! SiteBuilder
> <http://us.rd.yahoo.com/evt=10469/*http://sitebuilder.yahoo.com> - Free,
> easy-to-use web site design software << File: ATT60966.txt >> 



More information about the AccessD mailing list