by Dinesh Thakur Category: DataBase

The fastest way to search for a particular record is to use the Seek method , which can be used only with a table recordset tab.The Seek method uses indexes for the search , which is much faster than checking every record in the table as you do in a find .

 

In order to do a seek , the field on which you search must be defined with an index.

Syntax:

Data1.Recordset.Seek ComparisonOperator , FieldValue

The comparison operator must be enclosed in quotation marks and can be any one of this "=",">=",">","<=","<".The field value is the actual value for which to search string literal must be enclosed in quotation marks;numeric values must not be so enclosed.

Example:

i. Data1.Recordset.Seek "=", "0-671-66398-4"

ii.Data1.Recordset.Seek ">=", 1 'find first record greater than or equal to 1 in the first position of the key

 

 



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.