BOF EOF

From GAB Help
Jump to: navigation, search

BOF (Beginning of File) indicates that the current record position is before the first record in a Recordset object, while EOF (End of File) indicates that the current record position is after the last record in a Recordset object. Both return a boolean (true/false). If either returns a true, there are no current records in the recordset. If you open a recordset that has at least 1 record, the first record is considered the first record and both BOF and EOF will return false.

Syntax

Variable.ODBC.ConnectionName!RecordsetName.BOF

Variable.ODBC.ConnectionName!RecordsetName.EOF

Arguments

None

Example

When looping through a recordset, you might do the following to loop though to the end. Remember, when EOF is true, either there are no records, or you have reached the end of the recordset, hense, end of file.

F.Intrinsic.Control.DoUntil(v.odbc.conx!rst.EOF,=,True)

'do something

F.Intrinsic.Control.Loop

When opening a recordset, you can use either BOF or EOF to determine if there is a record there. Both will return a false if at least 1 record is present.

F.Intrinsic.Control.If(V.ODBC.conx!rst.EOF,=,False)

'At least 1 record in the recordset

F.Intrinsic.Control.Else

'No record is available, recordset is empty

F.Intrinsic.Control.Endif

In the example above, you can also use F.Intrinsic.Control.If(V.ODBC.conx!rst.BOF,<>,True), which is "If the beginning of file is not equal to true".

Remarks

Source:

"BOF, EOF Properties (ADO)." Windows Dev Center. Microsoft MSDN. Web. 08 May 2012. <http://msdn.microsoft.com/en-us/library/windows/desktop/ms675787(v=vs.85).aspx>.