|
-
Oct 25th, 1999, 02:00 AM
#1
Thread Starter
Addicted Member
I have a recordset containing several thousand records and am populating a list box for a search with
data.recordset.movenext and list1.additem
Is there a quicker way to do this with a large recordset as it takes a while on the network to populate the list box (up to 25 secs!!)
Thanks
-
Oct 25th, 1999, 05:27 AM
#2
Frenzied Member
Are you hiding the control while populating it? This will consume less time as it doesn't have to do screen refreshes.
-
Oct 25th, 1999, 10:27 AM
#3
-
Oct 26th, 1999, 11:49 AM
#4
Other things you can do to optimize the transfer are..
Use an OpenForward Only Recordset and Reduce the Number of Object Branches,(Periods), being referenced, somthing like:
Code:
Private Sub Command1_Click()
Dim oDb As Database
Dim oRs As Recordset
Set oDb = OpenDatabase("BIBLIO.MDB")
Set oRs = oDb.OpenRecordset("SELECT Author FROM Authors", dbOpenForwardOnly)
While Not oRs.EOF
'In Some Cases, Referencing by the Field 'Name'
'Can be faster than the Index No.
List1.AddItem oRs(0)
oRs.MoveNext
Wend
Set oRs = Nothing
oDb.Close
Set oDb = Nothing
End Sub
On my P200 this Populated Over 6,000 Records in a little over 2 Seconds.
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|