Microsoft Remote Data ServiceMicrosoft Remote Data Service*
*Contents  *Index  *Topic Contents

Add Code to Move through the Displayed Recordset

You can use the Move methods with the Recordset in the RDS.DataControl object to navigate through the data records displayed in the data-bound controls on a Web page. For example, suppose you display a Recordset in a grid by binding to an RDS.DataControl object. You can then include First, Last, Next, and Previous buttons that users can click to move to the first, last, next, or previous record in the displayed Recordset. You do this by calling the MoveFirst, MoveLast, MoveNext, and MovePrevious methods of the RDS.DataControl object in the OnClick procedures for the First, Last, Next, and Previous buttons, respectively.

Search for the words "Tutorial: Move Through the Displayed Recordset." Copy the following script and paste it under the comment.

SUB First_OnClick
	ADC.Recordset.MoveFirst
END SUB

SUB Next_OnClick
	If ADC.Recordset.EOF Then	'can not move beyond bottom record
		ADC.Recordset.MoveFirst 
		Exit Sub
	End If	

	ADC.Recordset.MoveNext
END SUB

SUB Prev_OnClick
	If ADC.Recordset.BOF Then	'can not move beyond top ‘record
		ADC.Recorset.MoveFirst	'Get out of BOF buffer
		ADC.Recordset.MoveLast
		Exit Sub
	End If
	ADC.Recordset.MovePrevious
END SUB

SUB Last_OnClick
	ADC.Recordset.MoveLast
END SUB
</Script>

Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.