Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1

    Unanswered: Reconcile ADO dataset from ActiveX Script Task

    I'm having a bear of a time with this. I have a recordset that pulls data from one, single table. I would like to iterate through the set, do some processing based on that data, then delete all of the records in that recordset.

    I'm trying to do something like the following:

    Code:
    Set dbConn = CreateObject("ADODB.Connection")
    Set dbRS = CreateObject("ADODB.Recordset")
    
    dbConn.Open("myConnectString")
    dbRS.open dbSQLCmdText, dbConn, 2, 4
    
    While Not dbRS.EOF
       Do some stuff
       dbRS.Delete
    Wend
    
    dbRS.BatchUpdate
    
    dbRS.Close
    dbConn.Close
    I get an error stating:

    "Multiple-Step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done."

    This seems to indicate the connection doesn't think it's capable of reconciling the recordset. Is there a way to do this in one batch or should I stick with executing a single delete statement for every record in my recordset?
    Last edited by Teddy; 05-12-06 at 15:45.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  2. #2
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    Quote Originally Posted by Teddy
    I'm having a bear of a time with this. I have a recordset that pulls data from one, single table. I would like to iterate through the set, do some processing based on that data, then delete all of the records in that recordset.

    I'm trying to do something like the following:

    Code:
    Set dbConn = CreateObject("ADODB.Connection")
    Set dbRS = CreateObject("ADODB.Recordset")
    
    dbConn.Open("myConnectString")
    dbRS.open dbSQLCmdText, dbConn, 2, 4
    
    While Not dbRS.EOF
       Do some stuff
       dbRS.Delete
    Wend
    
    dbRS.BatchUpdate
    
    dbRS.Close
    dbConn.Close
    I get an error stating:

    "Multiple-Step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done."

    This seems to indicate the connection doesn't think it's capable of reconciling the recordset. Is there a way to do this in one batch or should I stick with executing a single delete statement for every record in my recordset?
    It is about a year since I did any vb, but should'nt there be a dbRS.MoveNext in your loop?
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Not if I'm deleting the current record at the end of the loop.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

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