Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Record is in use by another user
Message
De
11/12/1997 10:16:56
 
 
À
10/12/1997 20:04:42
Shihchau Tai
Apic Systems Pte Ltd
Singapore, Singapour
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00065097
Message ID:
00065251
Vues:
29
>>I don't remember who was having this problem, but I was looking through some stuff and came across this article concerning this error:
>>
>>A1. Here's how I ran into the problem: My add button adds a single record to my form's parent table, and then adds six records to my form's child table. Buffering is on for both tables. The user moves to the child table grid, and tries to enter data in one of the newly added records. "Record is in use by another" error occurs.
>>
>>MS acknowledges this as a bug.
>>
>>Workaround: After adding the single record to the parent table, I do a thisform.refresh(). Then add the six records to the child table. (You tell me why this works!)
>>
>>For example:
>>
>>Create 2 tables, parent with fields ID, parentname and child with fields ID, childname. Create an index on id in table child.
>>
>>Create a form. Put these tables in the data environment. Create a one-to-many relationship between parent ID and child ID index by dragging the parent ID field to the child ID index. Put the parent fields on the form as text boxes. Put the child table on the form as a grid.
>>
>>Create a command button "ADD". This button will add one record to the parent table and five to the child table. In the add click method, put:
>>
>>local nCounter, nNewID
>>select parent
>>calculate max(id) to nNewID
>>nNewID = nNewID + 1
>>insert into parent (id) values (nNewID)
>>*---- THIS LINE FIXES THE "RECORD IN USE BY ANOTHER USER" ERROR:
>>*thisform.refresh
>>*---- !!!!
>>for nCounter = 1 to 5
>>insert into child (id) values (nNewID)
>>endFor
>>*---- THIS LINE FIXES THE CRAZY GRID DISPLAY
>>*select child
>>*goto -1
>>*---- !!!!
>>thisform.refresh()
>>
>>Now run this form. It runs just fine.
>>
>>Create the bug. Modify the form by setting the form buffermode property to 2-optimistic. Run the form again. You will get the "record is in use by another user" error when you try to edit the newly added child records.
>>
>>Fix the bug. Remove the "*"s from the above code as indicated. The form works now.
>>
>>By the way, you can also fix this bug by including a tableupdate for the child records after adding. But that defeats the purpose of the buffering. However, maybe it gives us a hint of what is happening...
>>
>>(Alexandra W. Saur, CIS ID: 71054,2535)
>
>
>I was one of those who asked the question months ago and I solved the problem by putting the alias in RECNO(). However, I am plagued by 'File is in use' now and I hope your mail will help.
>
>If there is a way, this mail of yours should be posted constantly because I am sure most of the newer VFP users will face the problem. With this kind of stupid bug in VFP, I am sure people who has no strong attachment to VFP would have given it up as soon as they have started.

I will leave it up to Michel to decide if it should be in the FAQ of this site.
Erik Moore
Clientelligence
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform