BUG: "File is in use" Error with Only One User (260227)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 3.0
  • Microsoft Visual FoxPro for Windows 3.0b
  • Microsoft Visual FoxPro for Windows 5.0
  • Microsoft Visual FoxPro for Windows 5.0a
  • Microsoft Visual FoxPro for Windows 6.0

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.

MORE INFORMATION

Steps to Reproduce Behavior

  1. 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
    					
  2. 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 = "testTable1"
    
       RecordSource = "testTable2"
       RecordSourceType = 1
    
       ChildOrder = "cTable1ID"
       RelationalExpr = "cTable1ID"
    
       ColumnCount = 2
    
       Column1.ControlSource = "testTable2.cTable2ID"
       Column2.ControlSource = "testTable2.cDesc"
    
       *!* 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, '')
    					
  3. Run the form.
  4. Type aa into the text box, and then press the command button.
  5. 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.

Modification Type:MajorLast Reviewed:5/10/2003
Keywords:kbBug kbCodeSnippet kbDatabase kbpending KB260227