Visual Basic: RDO Data Control

Visual Studio 6.0

MoveFirst, MoveLast, MoveNext, MovePrevious Methods (Remote Data)

See Also    Example    Applies To

Repositions the current row pointer to the first, last, next, or previous row in a specified rdoResultset object and makes that row the current row.

The syntax for these methods have these parts:

object.{MoveFirst | MoveNext | MovePrevious}

object. MoveLast ([Options as Variant])

Part Description
object An object expression that evaluates to a rdoResultset object.
options A Variant or constant that determines how the operation is carried out, as specified in Settings.


You can use the following constant for the options argument:

Constant Value Description
rdAsyncEnable 32 Execute operation asynchronously.


Use the Move methods to reposition the current row pointer from row to row without applying a condition.

If you specify the rdAsyncEnable option with the MoveLast method, the move operation is executed asynchronously. That is, control is returned to your application immediately often before the operation has completed. This prevents your application from blocking until the operation is complete. To check for completion of the operation, you can either wait for the QueryComplete or RowCurrencyChange events, or periodically check the StillExecuting property which returns False when the move operation is complete.

Caution   If you edit the current row, be sure to save the changes using the Update method before you move to another row. If you move to another row without updating, your changes are lost without warning.

When you open the result set named by object, the first row is current and the BOF property is set to False. If the result set contains no rows, the BOF property is set to True, and there is no current row.

If the first or last row is already current when you use MoveFirst or MoveLast, the current row doesnt change.

If you use MovePrevious when the first row is current, the BOF property is set to True, and there is no current row. If you use MovePrevious again, an error occurs; BOF remains True.

If you use MoveNext when the last row is current, the EOF property is set to True, and there is no current row. If you use MoveNext again, an error occurs; EOF remains True.

If you use MoveLast on an rdoResultset object based on an SQL-specific query or rdoQuery, the query is forced to completion and the rdoResultset object is fully populated.

If you use any method that repositions the current row pointer after using the Edit or AddNew method but before using the Update method, any changes made to the copy buffer are lost.

To move the position of the current row in an rdoResultset object a specific number of rows forward or backward, use the Move method.

To position the current row pointer based on an absolute row number, use the AbsolutePosition property. To position the current row pointer based on a percentage of the accessed rows of a result set, use the PercentPosition property.

When you use the Move method or any other method to reposition the current row pointer, the RowCurrencyChange event is fired.

When using a forward-only rdoResultset, the you can reposition the current row only by using the MoveNext method. You cannot use the MoveLast, MovePrevious, MoveFirst, or Move method, or the PercentPosition or AbsolutePosition property, to reposition the current row pointer. If you use one of the prohibited Move methods on a forward-only result set, your code will trip an ODBC "Fetch type out of range" error.