Finds the row with the exact matching key value.

Syntax

<oRef>.findKey(<exp>)

<oRef>

The rowset in which to do the search.

<exp>

The value to search for.

Property of

Rowset

Description

findKey( ) performs an indexed search in the rowset, using the index specified by the rowset’s indexName property. It looks for the first row in the index whose index key value matches <exp>, returning true or false to indicate whether a match is found.

findKey( ) is a navigation method; calling it fires the canNavigate event. If canNavigate returns false, findKey( ) does not attempt a search. If canNavigate returns true, and a search is attempted but fails, the row cursor remains at the current row and does not encounter an end-of-set. The onNavigate event always fires after a search attempt. For more information on how navigation methods interact with navigation events and implicit saves, see next( ).

findKey( ) always performs a partial key match with strings. For example, findKey("S") will find "Sanders", or whatever is the first key value that starts with the letter "S". To perform a full key match, pad <exp> with enough extra spaces to match the length of the index key value.