BUG: No Error Produced when Data Changed in DataControl
ID: Q119244
|
The information in this article applies to:
-
Microsoft Visual Basic Standard and Professional Editions 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
- On a computer with the Visual Basic 3.0 Compatibility Layer installed,
start a new project in Visual Basic. Form1 is created by default.
- Add a text box (Text1), command button (Command1), and data control
(Data1) to the form.
- 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 query words:
3.00
Keywords :
Version :
Platform :
Issue type :