BUG: Error with Edit Method After Rollback of Previous Edit

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 query words: buglist3.00 3.00

Keywords :
Version :
Platform :
Issue type :


Last Reviewed: August 19, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.