Results 1 to 3 of 3
  1. #1
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496

    checking for end of file

    on a different form, I've got the below code (it works just fine)
    on a new form, I'm using nearly the exact same text (adjusted for a different table...)
    and even when at the last record in the tableif Rst.EOF returns "false"


    HTML Code:
    Dim rst As DAO.Recordset
        Set dbs = CurrentDb()
        Set rst = dbs.OpenRecordset("SELECT * FROM tbeSubmittal")
        If rst.EOF Then    
                strPrompt = "You are at the end of the database;" & Chr(13) & Chr(10) & "Do you want to create a new record?   "
                Response = MsgBox(strPrompt, vbQuestion + vbYesNo + vbDefaultButton1, "END of DATABASE")
                <...>
    perplexed (nevermind the curiosities of the Universe...)
    but with many thanks in advance,
    Mark

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I misread your post.

    and even when at the last record in the tableif Rst.EOF returns "false"
    If there are records in the table, rst.EOF will be false until you try to move PAST the last record

    If you are at the last record and you issue a "MoveNext ", EOF will then be True.
    Just opening a recordset on a table that has records and moving to the last record will not set EOF to True.

  3. #3
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496
    my gosh... maybe it is Friday,
    ...and I know I ought to be better with
    Code:
    Option Explicit
    never-the-less, when all else fails: look for the obvious:

    Code:
     Public dbs As DAO.Database
     Public rst As DAO.Recordset
    what a concept
    THNX !!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 10-29-2013, 09:31 AM
  2. checking records
    By Linda1234 in forum Queries
    Replies: 4
    Last Post: 09-26-2012, 10:09 PM
  3. Which is better? checking in VBA or SQL
    By allstar45 in forum Queries
    Replies: 1
    Last Post: 02-17-2012, 12:13 PM
  4. Checking beforehand whether a file exists
    By Ronald in forum Programming
    Replies: 2
    Last Post: 07-27-2011, 08:48 AM
  5. Checking a table for changes
    By Rando in forum Queries
    Replies: 2
    Last Post: 10-07-2010, 09:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums