Address Book Navigation Buttons

Microsoft ActiveX Data Objects (ADO)

Address Book Navigation Buttons

The Address Book application displays the navigation buttons at the bottom of the Web page. You can use the navigation buttons to navigate through the data in the HTML grid display by selecting either the first or last row of data, or rows adjacent to the current selection.

Navigation Sub Procedures

The Address Book application contains several procedures that allow users to click the First, Next, Previous, and Last buttons to move around the data.

For example, clicking the First button activates the VBScript First_OnClick Sub procedure. The procedure executes a MoveFirst method, which makes the first row of data the current selection. Clicking the Last button activates the Last_OnClick Sub procedure, which invokes the MoveLast method, making the last row of data the current selection. The remaining navigation buttons work in a similar fashion.

' Move to the first record in the bound recordset.
Sub First_OnClick
    DC1.Recordset.MoveFirst
End Sub

' Move to the next record from the current position 
' in the bound recordset.
Sub Next_OnClick
    If Not DC1.Recordset.EOF Then    ' cannot move beyond bottom record
        DC1.Recordset.MoveNext
        Exit Sub
    End If    
End Sub

' Move to the previous record from the current position in the bound 
' recordset.
Sub Prev_OnClick
    If Not DC1.Recordset.BOF Then    ' cannot move beyond top record
        DC1.Recordset.MovePrevious
        Exit Sub
    End If
End Sub

' Move to the last record in the bound recordset.
Sub Last_OnClick
    DC1.Recordset.MoveLast
End Sub