Results 1 to 4 of 4
  1. #1
    Philosophaie is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    28

    Reenter Access from deleted RecordSet

    Error code:

    Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
    In Excel 2007 and Access 2007, from Excel I deleted every RecordSet, rs. (bad move)

    Code:
        rs.MoveFirst
        Do Until rs.EOF
            rs.Delete
            rs.Update
            rs.MoveNext
        Loop
    I then am trying to reenter the new data contained in Excel but it will not let me due to the above error.



    How do I write over the deleted RecordSet (#Deleted)?

    Here is my code(my connection string works fine):

    Code:
        rs.MoveFirst
        For k = 1 To Sheets("2013").Cells(Rows.Count, "A").End(xlUp).Row - 4
            rs!Index = Sheets("2013").Cells(k + 4, 1).Value
            rs!DatePaid = Sheets("2013").Cells(k + 4, 2).Value
            rs!WhatPaid = Sheets("2013").Cells(k + 4, 3).Value
            rs!AmtPaid = Sheets("2013").Cells(k + 4, 4).Value
            rs!total = Sheets("2013").Cells(k + 4, 5).Value
            rs!AmtRec = Sheets("2013").Cells(k + 4, 6).Value
            rs!WhatRec = Sheets("2013").Cells(k + 4, 7).Value
            rs!DateRec = Sheets("2013").Cells(k + 4, 8).Value
            rs.Update
        Next k

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    If the recordset is empty, you'll get that error on the MoveFirst. If you're trying to add records to the recordset, drop that line and use the AddNew method.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Philosophaie is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    28
    I get the same error. It can not lock on to a Recordset line even with " rs.AddNew".

    For k = 1 To Sheets("2013").Cells(Rows.Count, "A").End(xlUp).Row - 4
    rs.AddNew
    rs!Index = Sheets("2013").Cells(k + 4, 1).Value
    rs!DatePaid = Sheets("2013").Cells(k + 4, 2).Value
    rs!WhatPaid = Sheets("2013").Cells(k + 4, 3).Value
    rs!AmtPaid = Sheets("2013").Cells(k + 4, 4).Value
    rs!total = Sheets("2013").Cells(k + 4, 5).Value
    rs!AmtRec = Sheets("2013").Cells(k + 4, 6).Value
    rs!WhatRec = Sheets("2013").Cells(k + 4, 7).Value
    rs!DateRec = Sheets("2013").Cells(k + 4, 8).Value
    rs.Update
    Next k

    How do I repopulate my database?
    Last edited by Philosophaie; 07-02-2013 at 07:41 PM.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    What's the full code, and where does the error occur?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Deleted Column in Access
    By Khauck in forum Access
    Replies: 4
    Last Post: 04-11-2013, 10:07 AM
  2. Replies: 1
    Last Post: 07-19-2012, 09:25 PM
  3. delete query produce #deleted in all deleted values
    By learning_graccess in forum Queries
    Replies: 2
    Last Post: 03-31-2012, 07:20 AM
  4. Replies: 2
    Last Post: 03-08-2012, 12:59 PM
  5. Replies: 2
    Last Post: 09-23-2010, 02:50 PM

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