FindLast Method

Object List Next Object

Defined By:
Recordset

Description:

Finds the last occurrence of a string in the underlying database object that matches the search string. The CurrentRowNumber property is set to the Row in which the search string was found.

Declaration:

Sub FindLast(ByVal target As String)

Details:

Use FindLast with any of the other Find methods (FindFirst, FindNext, FindPrev) to search your database for records that match the criteria you specify. If RecordSet contains several records that match the criteria, FindFirst locates the first occurrence, and FindLast locates the last occurrence. FindNext and FindPrev can be used after using a FindFirst or FindLast to locate all other matches. You can use a Move operation after a Find to move to another record without matching any criteria.

If no records match the specified criteria (meaning the Find method fails), the NoMatch property is set to True and the current record remains unaffected by the Find method.

If you are using a DataControl and edited or added records exist that have not been saved, a Find or Move method will cause the record to update automatically if it has not already been stopped when the Validate event is executed. Closing the RecordSet under the same conditions will give the same results.

The format of the search string is dependent on the DatabaseType. For ODBC databases, the
search string format should be similar to the Where clause of an SQL statement (e.g., select * from addresses where name = 'Kenny Johnson')).

For FixedAscii and DelimitedAscii, the search string will be used directly to search for it in the RecordSet's underlying database object. Additionally, for these database types, the search string can be a regular expression.


Caution: You will lose any existing changes and will not get a program exception if you are not using a DataControl under the conditions described above.

See Also:

MoveFirst, MoveLast, MoveNext, MovePrev methods; NoMatch property; Validate event