FindFirst, FindLast, FindNext, FindPrevious Methods
See Also Example 1 Example 2 (Professional Edition Only)
Description
Locate the first, last, next, or previous record that satisfies the specified criteria and make that record the current record
Syntax
recordset.FindFirst criteria
recordset.FindLast criteria
recordset.FindNext criteria
recordset.FindPrevious criteria
Remarks
Each Find method uses these parts:
Part Description
recordset The Recordset property of a data control. In the Professional Edition, can also be an object variable identifying a Dynaset, or Snapshot.
criteria String expression (the WHERE clause in an SQL string without the word "WHERE") specifying the records you want.
If recordset contains more than one record that matches criteria, FindFirst locates the first occurrence, FindNext locates the next occurrence, and so on. You can follow a Find operation with a Move operation, such as MoveNext, which moves to the next record regardless of whether it matches any criteria.
If no matching records are found, the NoMatch property is True and the current record remains the same as before the Find method was used.
With a data control, if an Edit or AddNew operation is pending when you use one of the Find or Move methods, Update is automatically invoked if not stopped during the Validate event.
Caution In the Professional Edition, if you are not using a data control and use one of the Find or Move methods while an Edit or AddNew operation is pending, any existing changes will be lost and no error will occur.