[AccessD] Slow loop through list box

David Emerson davide at dalyn.co.nz
Wed Sep 24 16:46:49 CDT 2003


How do I determine which item has just been selected/deselected?  Then I 
could add it if selected, or delete if deselected.

David

At 24/09/2003, you wrote:
>Hi David
>
>It sounds/looks like you are building the complete list every time an
>item is selected. Why not add only that item which has been selected?
>
>/gustav
>
>
> > I have a listbox which is used to select clients for including in
> > reports.  When the listbox is updated I have a separate text box that 
> shows
> > the names of the clients selected and the number selected.  At the same
> > time I store the ID's of the clients in a table that is used to filter out
> > the required client records. The initial list box has over 1800 names.  It
> > is taking about 10 seconds to update the lists each time a client is
> > selected.  If I rem out the adding of ID's to the table then the time
> > reduces to about 3 seconds.  The main part of the code is -
>
> >      With Me!lstClientList
> >          For Each varItem In .ItemsSelected
> >              If .Selected(varItem) = True Then
> >                  strList = strList & .Column(1, varItem) & vbCrLf  ' Adds
> > client name to selected list
> >                  intClientNo = intClientNo + 
> 1                            '
> > Counts number of selected clients
> >                  rst.AddNew
> > 'Add client ID to table
> >                      rst!CustIDNo = .Column(0, varItem)
> >                  rst.Update
> >              End If
> >          Next varItem
> >      End With
>
> > Any thoughts as to how I can speed up the process?  The BE is SQL2000.
>
>_______________________________________________
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com



More information about the AccessD mailing list