Results 1 to 4 of 4

Thread: Eof,bof

  1. #1
    Join Date
    Sep 2005
    Posts
    313

    Unanswered: Eof,bof

    EOF = current record position after the last record
    BOF = current record position before the first record


    set s = db.openrecordset("set")
    If Not (s.EOF And s.BOF) Then
    ...........
    end if


    above code, does that mean if the current record position is 1st record, then .......


    Thanks

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    it only checks that your recordset contains one or more records

    add
    s.movefirst
    and you are certain you are on the first record.

    if you have not done anything else to the recordset it is most likely positioned at the first record, but why take the risk?

    izy
    currently using SS 2008R2

  3. #3
    Join Date
    Jul 2004
    Location
    Southampton, UK
    Posts
    368
    Quote Originally Posted by accessman2
    EOF = current record position after the last record
    BOF = current record position before the first record


    set s = db.openrecordset("set")
    If Not (s.EOF And s.BOF) Then
    ...........
    end if


    above code, does that mean if the current record position is 1st record, then .......


    Thanks
    No it does not. The current position could be any record for Not(s.EOF And s.BOF) to be true.

    You are actually saying "If the current position is not before the first record and not after the last record then..." so this could be any record position from the first to the last.

    By definition you are also saying "if it is not the case that there are no records then..." or put it another way "if there are records then..."

    if you want to check if the current record position is the first record of the recordset, then look at AbsolutionPosition (doesn't work withr forward only type recordsets).

    Or find out what the first value in your index is and check against that.

    hth
    Chris

  4. #4
    Join Date
    Jul 2004
    Location
    Southampton, UK
    Posts
    368
    Quote Originally Posted by howey
    By definition you are also saying "if it is not the case that there are no records then..." or put it another way "if there are records then..."
    I need to correct myself here as I don't think this is explicitly true. Suppose you have only one record and you are positioned on that record. Then you delete it. EOF and BOF will still be false and won't be set to true unless to attempt to move position. So not(s.eof and s.bof) would still be true rather than false as you would expect!!
    Chris

Posting Permissions

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