BUG: Error with Edit Method After Rollback of Previous Edit

Last reviewed: June 21, 1995
Article ID: Q119733
The information in this article applies to:
  • Microsoft Visual Basic Programming System for Windows, version 3.0

SYMPTOMS

You may receive an "Update without AddNew or Edit" or "No current record" run-time error message when using the Edit method on a dynaset, if you have previously used Rollback to roll back a transaction that contained an Edit method without a corresponding Update method.

WORKAROUND

To work around this problem, you can either ensure that you perform an Update before issuing the Rollback or use a "dummy" AddNew method after the Rollback.

STATUS

Microsoft has confirmed this to be a bug in Visual Basic version 3.0. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

To reproduce this problem, perform the following steps:

  1. Start a new project in Visual Basic. Form1 is created by default.

  2. Add a command button (Command1) to the form.

  3. Add the following code to the Command1_Click event:

         Sub Command1_Click()
           Dim db As database
           Dim ds As dynaset
    

           Set db = OpenDatabase("biblio.mdb")
           Set ds = db.CreateDynaset("select * from authors")
           ds.Filter = "au_id > 1"
           Set ds = ds.CreateDynaset()
    

           BeginTrans
           ds.Edit
    

           'ds.update    ' This is the irst workaround.
    
           Rollback
    
           'ds.addnew    ' This is the second workaround.
    
           ds.Edit       ' The error occurs here.
    
         End Sub
    
    

  4. Press F5 to run the code.

An "Update without AddNew or Edit" error message will display on the second ds.Edit statement. (If you have the Microsoft Jet 2.0/Visual Basic 3.0 Compatibility Layer installed, you may receive a "No current record" error at this point instead.)

To work around this problem, you can perform an Update immediately before the Rollback. This will have no permanent effect: the Rollback will undo the Update operation because the Update is inside the transaction. Another option is to perform an AddNew before the first Edit after the Rollback. (The AddNew will be voided by the Edit because the Edit occurs before an Update.)


Additional reference words: buglist3.00 3.00
KBCategory: kbprg kbbuglist
KBSubcategory: APrgDataAcc


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 21, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.