Results 1 to 10 of 10

Thread: Database - What does this error mean, and how do I fix it?

Threaded View

  1. #7

    Thread Starter
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Database - What does this error mean, and how do I fix it?

    "Either BOF or EOF is True..."
    What it means:
    You have tried to work with a record (eg: reading or writing a value), but there is no record to work with.

    How to solve it:
    For one reason or another there is no current record, and what you are doing needs one.

    This error most often happens because of one of the following:
    • You have just opened the recordset, and tried to use the values - but did not check if there are any records first. You can do this by checking the BOF and EOF properties of the recordset, eg:
      VB Code:
      1. objRs.Open ...
      2. If objRs.BOF and objRs.EOF Then
      3.   MsgBox "no records returned!"
      4. Else
      5.   'use values
      6. End If
    • You performed a .MoveNext when .EOF was true, or .MovePrev when .BOF was true, or any kind of Move when both were true. Whichever it was, what you did is not recommended - you should check for .EOF/.BOF first, and only move if appropriate.

    • You have just performed a .Delete on a record. Depending on where the record is in the recordset, there may not be a "current record" afterwards.. you may be at BOF or EOF (or both if there are no records left in the recordset).

      After deleting a record you should check the state of BOF and EOF, if both are true then you can no longer read/edit/delete records until more have been added. If either BOF or EOF are true, move to an appropriate record (perhaps .MoveFirst for BOF).


    Last edited by si_the_geek; Sep 30th, 2013 at 02:10 PM. Reason: fixed links

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width