FindFirst, FindNext (Recordset) Method

Locates the first or next record in a Recordset object that satisfies the specified criteria and makes that record the current record.

Applies To

Recordset object

Syntax

Recordset.FindFirst(cFilter)

Recordset.FindNext

Arguments

cFilter

A String value that contains a statement specifying the column name, comparison operator, and value to use in the search. For Catalyst Mobile SQL Structured Query Language (SQL) is a interactive and programming language designed for the querying, modifying, and managing of data in relational database management systems., the cFilter can be same as the expression in the Where statement.

Return Value

True if matching records are found, otherwise False.

Execution Context

Client and Server

Remarks

For Catalyst Server SQL and Host Database, only a single-column name may be specified in criteria. This method does not support multi-column searches. With Catalyst Mobile SQL, the cFilter can be same as the expression in the Where statement.

If you want to include all the records in your search ¾ not just those that meet a specific condition ¾ use the Move methods to move from record to record.

If a record matching the criteria is not located, the current record pointer is unknown, and the return value is False. If recordset contains more than one record that satisfies the criteria, FindFirst locates the first occurrence, FindNext locates the next occurrence, and so on.

Each of the Find methods begins its search from the location and in the direction specified in the following table.

Find method

Begins searching at

Search direction

FindFirst

Beginning of recordset

End of recordset

FindNext

Current record

End of recordset

Using one of the Find methods is not the same as using a Move method, however, which simply makes the first, last, next, or previous record current without specifying a condition. You can follow a Find operation with a Move operation.

Always check the return value to determine whether the Find operation has succeeded. If the search succeeds, the return value is True. If it fails, the return value is False and the current record is not defined. In this case, you must position the current record pointer back to a valid record.

Example

If rsVehicleInfo.FindFirst("VehicleID = 1234") Then

rsVehicleInfo.Field("Color").Value = "Green"

    rsVehicleInfo.Edit

End If