BOF, EOF Properties (Remote Data)

       

Syntax

object.BOF

object.EOF

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Return Values

The BOF property return values are:

Value Description
True The current row position is before the first row.
False The current row position is on or after the first row.

The EOF property return values are:

Value Description
True The current row position is after the last row.
False The current row position is on or before the last row.

Remarks

The BOF and EOF return values are determined by the location of the current row pointer — if this pointer is valid. If either BOF or EOF is True, there is no current row, and any attempt to reference rdoResultset data results in a trappable error.

You can use the BOF and EOF properties to determine whether an rdoResultset object contains rows or whether you've gone beyond the limits of an rdoResultset as you move from row to row.

If you open an rdoResultset containing no rows, BOF and EOF are set to True, and the result set's RowCount property setting is 0. When you open an rdoResultset that contains at least one row, the first row is the current row and BOF and EOF are False; they remain False until you move beyond the beginning or end of the rdoResultset using the MovePrevious or MoveNext method, respectively. When you move beyond the beginning or end of the rdoResultset, there is no current row.

If you delete the last remaining row in the rdoResultset object, BOF and EOF might remain False until you attempt to reposition the current row.

If you use the MoveLast method on an rdoResultset containing rows, the last row becomes the current row; if you then use the MoveNext method, the current row becomes invalid and EOF is set to True. Conversely, if you use the MoveFirst method on an rdoResultset containing rows, the first row becomes the current row; if you then use the MovePrevious method, there is no current row and BOF is set to True.

Typically, when you work with all the rows in an rdoResultset, your code will loop through the rows using MoveNext until the EOF property is set to True.

If you use MoveNext while EOF is set to True or MovePrevious while BOF is set to True, a trappable error occurs.

This table shows which Move methods are allowed with different combinations of BOF and EOF.

MoveFirst,
MoveLast
MovePrevious,
Move < 0

Move 0
MoveNext,
Move > 0
BOF = True,
EOF = False
Allowed Error Error Allowed
BOF = False,
EOF = True
Allowed Allowed Error Error
Both True Error Error Error Error
Both False Allowed Allowed Allowed Allowed

Allowing a Move method doesn't mean that the method will successfully locate a row. It merely indicates that an attempt to perform the specified Move method is allowed and won't generate an error. The state of the BOF and EOF properties may change as a result of the attempted Move.

Effect of specific methods on BOF and EOF settings: