Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Poplulating a list box

Status
Not open for further replies.

netsmurph

Technical User
Mar 19, 2003
63
GB
I have taken over on a project making enhancements to an auditing tool. It has one module that takes in stock entries and loads values into a list box to "remember" the last selected list.

The code being used to popluate this list box on form load is below, but it takes an absolute age (maybe 60 secs - which is deemed unacceptable) to run through this procedure if there are more than 2000 records or so.

What i am wondering if whehter there is any other way to update this list box object other than looping through each value and updating as below.

Any suggestions would be much appreciated.


Andrew


Dim iCurrentRow As Integer
Dim ssql As String
Dim totalRows As Long

'* Iterate through the multi-list object and either selecting or deselecting all choices
totalRows = Me.lstType.ListCount
With Me.lstType
'For iCurrentRow = 0 To .ListCount - 1
For iCurrentRow = 0 To Me.lstType.ListCount - 1
Select Case bySelectAll
Case 1 '* True
.SELECTED(iCurrentRow) = True
Case 2 '* Invert
.SELECTED(iCurrentRow) = Not (.SELECTED(iCurrentRow))
' Case 3 '* Invert
' .Selected(iCurrentRow) = DLookup("Selected", "tblTYPE", "type like '" & LTrim(Me.lstType.Column(0, iCurrentRow)) & "'")
End Select
Next iCurrentRow
End With
 
Sorry - posted this into the wrong forum - will post it into VBA forum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top