Microsoft KB Archive/119733

= BUG: Error with Edit Method After Rollback of Previous Edit =

Article ID: 119733

Article Last Modified on 1/8/2003

-

APPLIES TO


 * Microsoft Visual Basic 3.0 Professional Edition

-



This article was previously published under Q119733



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:  Start a new project in Visual Basic. Form1 is created by default. Add a command button (Command1) to the form.  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  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: kbbug KB119733

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.