Microsoft KB Archive/260227

= BUG: &quot;File is in use&quot; Error with Only One User =

Article ID: 260227

Article Last Modified on 5/10/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q260227



SYMPTOMS
When you use buffering and grids on a form, you might see the following error message even though only one user is accessing tables while records are being inserted:

File is in use by another user.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior
  Use this sample code to create a database named testData: *!* Start of code CREATE DATABASE testData

CREATE TABLE testTable1 ; (cTable1ID C(10), ;      cDesc C(10)) CREATE TABLE testTable2 ; (cTable2ID C(10), ;       cTable1ID C(10), ;       cDesc C(10))

ALTER TABLE testTable1 ; ADD PRIMARY KEY cTable1ID TAG cTable1ID ALTER TABLE testTable2 ; ADD PRIMARY KEY cTable2ID TAG cTable2ID

SELECT testTable2 INDEX ON cTable1ID TAG cTable1ID

ALTER TABLE testTable2 ; ADD FOREIGN KEY ; TAG cTable1ID ; REFERENCES testTable1 ; TAG cTable1ID CLOSE ALL *!* End of code   Create a form, and add a text box, a command button, and a grid to the form. Add testTable1 and testTable2 to the DataEnvironment: *!* Grid Properties LinkMaster = &quot;testTable1&quot;

RecordSource = &quot;testTable2&quot; RecordSourceType = 1

ChildOrder = &quot;cTable1ID&quot; RelationalExpr = &quot;cTable1ID&quot;

ColumnCount = 2

Column1.ControlSource = &quot;testTable2.cTable2ID&quot; Column2.ControlSource = &quot;testTable2.cDesc&quot;

*!* Form Properties DataSession = 2  && Private DataSession BufferMode = 2   && Optimistic Buffering

*!* Command1.Click INSERT INTO testTable1 ; (cTable1ID, cDesc) ; VALUES ; (ThisForm.Text1.Value, '') INSERT INTO testTable2 ; (cTable2ID, cTable1ID, cDesc) ; VALUES ; (, ThisForm.Text1.value, )

ThisForm.Grid1.SetFocus

*!* Grid1.Column2.Text1.Valid INSERT INTO testTable2 ; VALUES ; (, testTable1.cTable1ID, )  Run the form. Type aa into the text box, and then press the command button. Type aa1 into the text boxes in the grid, and then tab back through them. The second time you tab through the second text box (the one with the Valid method), the error message occurs.

Keywords: kbbug kbcodesnippet kbdatabase kbpending KB260227

-

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

© Microsoft Corporation. All rights reserved.