brKey method

Provides the ability to sequentially "cruise" on any defined b-tree index for an item-id.

Syntax

bValue = object.brKey( cChr, sKey, sIId, nVmc)

Parameters

Parameter Description
bValue The return value is a Boolean data type. It returns False only if the requested key is past the end of the index.
object An object variable that represents a clsD3Index object.
cChr A String containing a command character indicating the type of index search to use, as described in Settings (see below).
sKey A String containing the search string to be matched and returning the string actually matched.
sIId A String containing the item-id to match, and returns the item-id actually matched.
nVmc Optional. A Variant (Long subtype) containing the requested value.

Settings

Index Constants Value Description
D3IndexCompKey c Find first/Compare key
D3IndexLastKey l Find/Move to last key
D3IndexNextKey n Returns the next key
D3IndexPrevKey p Returns the previous key
D3IndexRtrnKey r Return index key and IID
D3IndexVerify v Verifies the index
D3IndexExtraKey x Extra key

Remarks

This method provides a single FlashBASIC-compatible interface to the index as an alternative to brFindFirst/Last/Next/Previous and brMoveFirst/Last/Next/Previous.

Example

Sub Search_Click()
   Dim oFile As clsD3File
   Dim oIndex As clsD3Index
   Dim sStart As String
 
   OpenConnection ' Subroutine to establish connection
 
   Set oFile = oConn.brOpenFile("customers")
   Set oIndex = oFile.brRoot("a1")
 
   ' Find the first and last customer with a name
   ' beginning with T - display results in a text box
   oIndex.brKey"c", "T", "" ' same as brFindFirst
   sSearchResults = "This search will result in customers: " & oIndex.brIndexKey
   oIndex.brKey"l", "T", "" ' same as brFindLast
 
   ' Results will be displayed in text box
   RichTextBox1.Text = sSearchResults & " through " & oIndex.brIndexKey
   oConn.brCloseFile oFile
   CloseConnection ' Subroutine to close connection
End Sub

FlashBASIC reference

key

Applies to

clsD3Index class