brBOL Property Example

Private Sub TestList_Click()

Dim oList As clsD3SelectList

Dim sCurrent As String

Dim i As Integer

 

OpenConnection ' Subroutine to establish connection

 

Set oList = oConn. brOpenSelectList(" select products")

oList.brReadnext

MsgBox "This list was produced by the command " & oList.brName

MsgBox "The first item is " & oList.brItemId

 

Do While True

Select Case InputBox("N for next, P for previous")

Case "N"

If oList.brEOL Then

MsgBox "End of list" 

Else

oList.brReadnext 

If oList.brEOL Then 

MsgBox "End of list" 

Else

MsgBox "The next item is " & oList.brItemId 

End If 

End If

 

Case "P"

If oList.brBOL Then

MsgBox "At beginning of list" & _ 

" - The first item is" & oList.brItemId 

Else

‘ Save current position 

sCurrent = oList.brItemIndex 

' Since the select list can be read only in a 

' forward direction, begin reading from top 

oList.brReselect 

' Read items up to one less than current 

For i = 1 To sCurrent - 1 

oList.brReadnext 

Next i 

MsgBox "The previous item is " & oList.brItemId 

End If

 

Case Else

Exit Do

 

End Select

Loop

 

oConn.brCloseSelectList oList

CloseConnection ' Subroutine to close connection

End Sub