BOOL FindFirst( LPCTSTR lpszFilter );
throw( CDaoException, CMemoryException );
Return Value
Nonzero if matching records are found, otherwise 0.
Parameters
lpszFilter
A string expression (like the WHERE clause in an SQL statement without the word WHERE) used to locate the record.
Remarks
Call this member function to find the first record that matches a specified condition. The FindFirst member function begins its search from the beginning of the recordset and searches to the end of the recordset.
If you want to include all the records in your search (not just those that meet a specific condition) use one of the Move operations to move from record to record. To locate a record in a table-type recordset, call the Seek member function.
If a record matching the criteria is not located, the current record pointer is undetermined, and FindFirst returns zero. If the recordset contains more than one record that satisfies the criteria, FindFirst locates the first occurrence, FindNext locates the next occurrence, and so on.
Caution If you edit the current record, be sure to save the changes by calling the Update member function before you move to another record. If you move to another record without updating, your changes are lost without warning.
The Find member functions search from the location and in the direction specified in the following table:
Find operations | Begin | Search direction |
FindFirst | Beginning of recordset | End of recordset |
FindLast | End of recordset | Beginning of recordset |
FindNext | Current record | End of recordset |
FindPrevious | Current record | Beginning of recordset |
Important When you call FindLast, the Microsoft Jet database engine fully populates your recordset before beginning the search, if this has not already been done. The first search may take longer than subsequent searches.
Using one of the Find operations is not the same as calling MoveFirst or MoveNext, however, which simply makes the first or next record current without specifying a condition. You can follow a Find operation with a Move operation.
Keep the following in mind when using the Find operations:
For more information about finding records, see the article DAO Recordset: Recordset Navigation in Visual C++ Programmer's Guide. For related information, see the topic "FindFirst, FindLast, FindNext, FindPrevious Methods" in DAO Help.
CDaoRecordset Overview | Class Members | Hierarchy Chart
See Also CDaoRecordset::Find, CDaoRecordset::FindLast, CDaoRecordset::FindNext, CDaoRecordset::FindPrev