Searching for Records in VB 6.0
Hello friends, I wanted to know, How is searching for records are done in Visual basic 6.0? I have no idea about it but as per my job I do have to search some records from Visual basic 6.0. In order to search the records from visual basic 6.0 and get the details of the appropriate user, I have to know how to search the records in visual basic 6.0. Can anyone help me out with this query so that I could search the records from VB 6.0 and get the details for the users.
Re: Searching for Records in VB 6.0
1.> In Dynaset or Snapshot Recordsets, The following methods are used to search for records in dynasets or snapshots:
1. FindFirst Begins search from the beginning of file
2. FindLast Begins search from the end of file
3. FindNext Begins search from current record and proceeds forward
4. FindPreviousBegins search from current record and proceeds backward.
Re: Searching for Records in VB 6.0
Criteria is similar to SQL's Where clause. Field names having spaces are enclosed in square brackets. For string comparison, the string must be enclosed in single quotes. However, for numeric comparison numbers are not enclosed in single quotes. v. You can use operators such as =, >, <, >=, <=, <>, Like, Between and In for comparison. ExamplesdatBooks.Recordset.FindFirst "BookId >= 10" datStudents.RecordSet.FindNext "Name = 'Salil'"B. In Table Recordsets (Seek Method) To search for records in Table Recordsets, the Seek Method is used.
Re: Searching for Records in VB 6.0
The Seek method uses indexes for searching. So, before calling the Seek method you must first set the Index property to the name of an index in your table. .In an Access table, the index on the primary key is called Primary Key. Other indexes usually have the names of the fields. Comparison Operator can be "=", "<", ">", "<=" or ">=". v. FieldValue is the value to be matched. Strings are enclosed in single quotes but numeric values are not.
Re: Searching for Records in VB 6.0
ExampledatBooks.Recordset.Seek ">", "10" datStudents.Recordset.Seek "=", "'Salil'"The NoMatch Property If none of the records satisfies the search condition in the above search methods, the No Match property is set to True. However, if a record is found, it is made the current record and the No Match property is set to False. This property is used to check whether a record is found. The BookMark Property (explained below) is generally used when no matching record is found.