I have an Access database with an ADO connection. When searching for an ID, i usually use to start searching from the first record till the item is found. Now i have almost 1,000 records and it takes longer than these days to find an item. What is the best approach to this challenge.
Regards
____________________________
IKBoye
18-11-2005 at 06:53 PM
|
Dave Green Level: Professor Registered: 20-10-2005 Posts: 90
Re: How To Improve A Search
Hi boye-i
I assume your ID that you are searching for is the primary key field and therefore indexed.
Searching through one record at a time is very slow. It doesn't sound like you are using SQL so why dont you use a SQL statement? This will use internal indexing and extract the required record very quickly.
eg
"SELECT * FROM myTable WHERE ID = '" & lsMyRecordRequiredID & "'"
Even if the field is not indexed, using a Select statement is still much faster than stepping and testing each record.
Hope this helps
Dave
____________________________
While Breath.Count>0
Live(gbRelax)
Wend