Work
with the DSO using ActiveX Methods
Since most HTML tags can only display field values for one record at
a time, it is necessary to use ActiveX Data Objects (ADO) to allow navigating
the records in the recordset. You can apply a method to the DSO to accomplish
this. To apply a method, use the following syntax:
id.recordset.method
Where id is the id of the data island and method is one supported by
ADO. The methods for navigating through a recordset include:
id.recordset.moveFirst()
id.recordset.movePrevious()
id.recordset.moveNext()
id.recordset.moveLast()
id.recordset.move(i) //where i is the record number
Assign
a recordset method
Edit FP1.htm by adding the recordset methods appropriately
to each button tag as follows:
<button onClick="Staff_Info.recordset.moveFirst()">
|< First
</button>
<button onClick="Staff_Info.recordset.movePrevious()">
< Back
</button>
<button onClick="Staff_Info.recordset.moveNext()">
Forward >
</button>
<button onClick="Staff_Info.recordset.moveLast()">
Last >|
</button>
Work
with DSO Properties
One of the problems with using the ActiveX navigation methods is when
you navigate to the last record and click forward, the page attempts
to access a record that doesn't exist. You can avoid this behavior by
changing the location properties of the current DSO record:
id.recordset.property
Location properties include:
id.recordset.BOF
id.recordset.EOF
id.recordset.Index
id.recordset.RecordCount
To test for the location of the record, you use an if statement and
insert it in the onClick event handler:
if (Staff_Info.recordset.BOF) Staff_Info.recordset.moveFirst()
if (Staff_Info.recordset.EOF) Staff_Info.recordset.moveLast()
Test
for location
Edit FP1.htm to add the code to the appropriate button
tags:
<button onClick="Staff_Info.recordset.moveFirst()">
|< First
</button>
<button onClick="Staff_Info.recordset.movePrevious();
if (Staff_Info.recordset.BOF) Staff_Info.recordset.moveFirst()">
< Back
</button>
<button onClick="Staff_Info.recordset.moveNext(); if
(Staff_Info.recordset.EOF) Staff_Info.recordset.moveLast()">
Forward >
</button>
<button onClick="Staff_Info.recordset.moveLast()">
Last >|
</button>
Save and refresh the file. Test the navigation.