BUG: No Error Produced when Data Changed in DataControl

Last reviewed: June 21, 1995
Article ID: Q119244
The information in this article applies to:
  • Standard and Professional Editions of Microsoft Visual Basic for Windows, version 3.0
  • Microsoft Jet 2.0/Visual Basic 3.0 Compatibility Layer

SYMPTOMS

This article describes a scenario where two or more Visual Basic applications using the Microsoft Jet 2.0/Visual Basic 3.0 Compatibility Layer to edit and update the same record at the same time fail to produce error message 3197: "Data has changed; operation stopped."

STATUS

Microsoft has confirmed this to be a bug in the Standard and Professional Editions of Visual Basic for Windows, version 3.0, and the Jet 2.0/Visual Basic 3.0 Compatibility Layer. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Problem

  1. On a computer with the Visual Basic 3.0 Compatibility Layer installed, start a new project in Visual Basic. Form1 is created by default.

  2. Add a text box (Text1), command button (Command1), and data control (Data1) to the form.

  3. Set the following properties of each of the controls according to the table listed below:

    Control    Property       Setting      Comment
    
Data1      DatabaseName  BIBLIO.MDB  Sample MDB in the VB directory.
Data1      RecordSource  Authors     The Authors table is in BIBLIO.MDB.
Text1      DataSource    Data1       Bind the text box to the data control.
Text1      DataField     Author      Put author's name in the text box.
Command1   Caption       Update      What the button does.

  • Place the following code in the Click() event for the command button:

          Sub Command1_Click()
             Data1.RecordSet.Update
          End Sub
    
    

  • Choose Make EXE File from the File menu, and compile the program as "DATAERR.EXE". Choose OK.

  • Exit Visual Basic, saving and naming the .MAK and .FRM files. In the Program Manager, choose Run from the File menu. Type "C:\VB\DATAERR.EXE" in the prompt and choose OK. Repeat this step so that you have two instances of the application running.

  • In the first instance, make a change to the author's name and choose Update (do not choose the data control).

  • In the second instance, make a different change to the author's name and choose Update. Notice that you did not get error message 3197 "Data has changed; operation stopped" as you should have.

    WORKAROUND

    To work around this problem, add the following lines of code to your Form_Load Event().

       Data1.Refresh        'Make sure the DatabaseName and RecordSource
                            'properties are set before you do this.
       Data1.RecordSet.Edit
       Data1.RecordSet.Update
    

  • Additional reference words: 3.00
    KBCategory: kbprg kbcode 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.