The BOF property indicates that the current record position in a Recordset object is before the first record. The EOF property indicates that the current record position in a Recordset object is after the last record.
object.BOF
object.EOF
The return values for the BOF and EOF properties are Boolean values.
The BOF property returns True if the current record position is before the first record, and False if the current record position is on or after the first record.
The EOF property returns True if the current record position is after the last record, and False if the current record position is on or before the last record.
If either the BOF or EOF property is True, there is no current record.
Use the BOF and EOF properties to determine whether a Recordset object contains records or whether you have gone beyond the limits of a Recordset object when you move from record to record.
If you open a Recordset object containing no records, the BOF and EOF properties are set to True, and the Recordset object’s RecordCount property setting is 0. When you open a Recordset object that contains at least one record, the first record is the current record and the BOF and EOF properties are False.
Calling the Delete method, even if it removes the only remaining record from a Recordset, does not change the setting of the BOF or EOF property.
The following table shows what happens to the BOF and EOF property settings when you call various Move methods but are unable to successfully relocate a record.
Method |
BOF |
EOF |
MoveFirst, MoveLast | True | True |
Move=0 | No change | No change |
MovePrevious, Move<0 | True | No change |
MoveNext, Move>0 | No change | True |