by Dinesh Thakur Category: DataBase

1. Two handy properties of the record set are BOF (beginning of file) and EOF (end of file). The BOF property is automatically set to true when the record pointer is before the first record in the record set.

This condition happens when first record is current and the user choose MovePrevious. The BOF property is also true if the record set is empty

 

2. The EOF property is similar to BOF; it is true when the record pointer moves beyond the last record in the record set and when the record set is empty.

 

3. When you are doing your own navigation in code, you need to check for BOF and EOF so that run-time errors do not occur. If the user clicks MoveNext when on the last record, what do you to do? Have the program cancel with a run time error? Display a message? Wrap around the first record? Keep the record pointer to last record?

 

4. In the following example, we will wrap-around method. If the user clicks on the MoveNext button from the end of the table, the first record becomes active record.

 

Private Sub cmdNext_Click()

„Move to Next record

datBooks.Recordset.MoveNext

If datBooks.Recordset.EOF Then

datBooks.Recordset.MoveFirst

End If

End Sub

 



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.