brKey Method 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