Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Record is in use by another user?
Message
From
05/11/1997 12:05:01
 
 
To
05/11/1997 11:49:44
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00058104
Message ID:
00058393
Views:
30
>>>>>>I have been tormented by this message for months. When two or more users start to use my invoice form, I get this error. I am on optimistic buffering mode (master - record buffering, detail - table buffering in grid). It happens occasionally when a user finishes one invoice (tableupdated) and is half way through the second invoice entry while another user is doing the same stuff.
>>>>>>
>>>>>>Anyone can suggest the possible cause of this problem?
>>>>>
>>>>>How do you add records to the table? How do you assign primary keys? Does your code contain any REPLACE FOR or REPLACE ALL statements?
>>>>
>>>>I use TASTRADE kind of NEWID to assign primary key (surrogated key). After APPEND BLANK in the master table, I use INSERT (key) VALUES (key) where key is the value obtained from master table. In grid, I use REPLACE key WITH master.key. I can't find any REPLACE ALL/FOR command in my form but I certainly have DELETE FOR EMPTY(xxxfield) (details table) before I do tableupdate. Do you think it matters?
>>>
>>>
>>>Yes.
>>>
>>>There are a certain number of commands that place an
>>>implicit file lock on the table. Replace all/for
>>>and also Delete all/for are a couple of them. You might
>>>try to find some other way to handle the deletion of records
>>>with empty fields if you feel that is necessary. Such as
>>>locate empty records within a do while loop and rlock with error
>>>handling before deleting.
>>>
>>>But probably you need to use form validation with optimistic
>>>buffering. The form validation will check for an empty in
>>>these key fields and not call the save until whatever validation
>>>you choose to put in there are satisfied.
>>>
>>>Hope this helps.
>>>
>>>Dan
>>
>>Thanks for the advice. But what do you mean by 'not call the save until whatever validation..'? I assume when you say 'form validation', you are saying validation in some controls. If this validation fails, I don't allow them to save. Do I get you right? If I get you right, I can't because there is nothing wrong with adding empty records.
>
>
>Let me see if I get you right you are issuing a DELETE FOR
>EMPTY(keyField) correct. When I first got started in foxpro just
>fresh form DBASE IV, I used a lot of DELETE FOR's and REPLACE
>FOR's. I had many problems with this "Record in user by another"
>message. The advice given to me was "Don't use these unless
>this is done as some type of night-time processing when there
>is no chance of other users being on the system. If at some
>point you need to get rid of these records, I would suggest an
>alternative way. Don't add these empty records if you were going
>to delete them anyways.
>
>If you have a "Save" button on your form. Add a method to your
>form "formValid" which checks for any number of things and
>returns a false if it does not pass. One of these tests could
>be checking for empty key fields. If the formValid method
>returns a false, let the user know what's happening but do not
>save this record.
>
>Dan
>:)
>
>HTH
Solid advice. If I remember correctly, you are using table buffering no? Then remember that tablerevert() keeps the ugly record from ever even seeing the table, so it doesn't even have to be deleted.
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform