Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Record Already Locked by this Session ????

Status
Not open for further replies.

LWB2005

Technical User
Jan 26, 2005
14
US
I created a form with a notebook object on it (the tabbed sheet). I used the form expert and so the data model has the "Master" table as well as a bunch of other tables.

One of the linked tables contains a bunch of memo fields which are spread over two tabs of the notebook object. This table does NOT have read only checked in the data model.

When I try to add data into this table using the form, it works fine for the initial entry. However, once I leave the record after initial entry, I get the "Record Already Locked by this Session" message in the status line if I try to edit (yes, I put it in edit mode) or add data to one of the empty fields in that particular record. I can add new records without trouble. I can delete the existing record and then it will let me re-enter data, but I just want to be able to add data to the record, not retype existing plus new data. I tried the shift F5 to manually unlock a record, which does produce the "Record is not locked" message in the status line. But as soon as I start to type data into a field, I get the "Record Already Locked by this Session".

What is going on, and how do I fix it? I'm running Paradox 10, on a Windows 2000 computer.

I suspect it is something obvious to you experts, but I sure can't figure it out!

Speaking of experts - whatever happened to Lance (FootPad)? He bailed me out of quite a few fixes in the past - I will be forever grateful. Glad to see Perrin, Mac, and now Tony are still dispatching expert advice!

Lynn
 
Are you attaching any ui or tcursor objects to the objects on the form? ...OR the underlying table(s)?

If so, and they are editing/posting a record, make sure they unlockrecord() as well; POSTrecord keeps the record locked.

And F5 only acts on visuals; tcursor/uiobject aren't affected.


Tony McGuire
"It's not about having enough time. It's about priorities
 
Tony,

Thanks for your reply. I don't have any TCursors or such - at least I don't think so. The table that has the problem is linked with a one-to-one relationship to the master. They both have the same key field. I devised a work around by changing the table by adding another field to the key, thus creating a one-to-many relationship with the Master. However, there will only be one record in the child table that corresponds to the parent table. There will be parent records that have no child records. I then put a MRO on the notebook pages and limited it to 1 record x 1 record.

Things seem to work fine now, but I don't comprehend why it didn't work correctly before. I have a feeling there is something basic that I don't understand!

Lynn
 
I tried to duplicate the problem which I think I have seen before.

I think the record is locked out by another user on the same row column coordinate or by your station with multiple windows open and an incomplete write.

Perhaps try post, or close edit F9 or something like that under each instance that you have called the form/table/tcursor.
Rich
Paradox 8
 
Do you, just by chance, have a button (or other construct) in the record objects of the tableframe that, say, posts the record and attempts to open a new or moveto another record?

If so, you are clicking on the button and Paradox is simultaneously trying to stay on the record (button pushed on button within record) and move to the next record.

Often, you will then wind up with the original record being kept in a lock situation.

Your one-one MRO would, I think by definition, 'fix' this situation.

Tony McGuire
"It's not about having enough time. It's about priorities
 
Rich & Tony,

I think we are getting close. Let me describe the form & data model. That might bring something more to light.

First I will describe what it looked like when I first posted the question.

The database tracks Project information in my office. There are many forms, but I'm just describing one - the Project History form. The data model consists of a Master (I'm not sure I understand this, but I think it came from using an Expert). The Master table is identical to the ProjectInfo table. In addition to the master there are the ProjectInfo table, the LatestBudget table and the History table in one to one relationships. In one to many relationships there are 3 tables: LogNumber, Threads, and Documents. I am not able to edit the ProjectInfo or the LatestBudget table, but I don't want to in this form. The problems was I could enter new data into the History table, but got the "record already locked in this session" error if I tried to edit existing data.

All the links are through the ProjectID (A20) field. And everything is linked to the Master. However the master does not occur on the form itself - the ProjectInfo table which is identical to the Master does.

The form has a Table frame on the right that is a list of the ProjectID field in ProjectInfo. I have code on it to highlight the current record - this is used to navigate through the database. On the left is the notebook (tabbed object). It has 5 tabs. Project Info which contains data from the ProjectInfo table; Description which contains a half of the fields from the History table; Accomplishment which contains the other half of the fields from the History table; Budget which contains read only data from the LatestBudget table; and Documents which contains tableframes from the LogNumber, Threads, and Documents tables. Also in the form besides the tableframe and the notebook object are a filter button (which is identical to the toolbar filter button) and VCR buttons. One of the notebook pages (tabs) includes a button to print a report.

I may well be doing something wrong with the Master and the repeat of the table it is based on in the Data model.

To work around the problem. I changed the History table by adding another field to the key (besides ProjectID). This turned the link into a one to many. However, I then had to put an 1x1 MRO on the Description tab with half of the History table fields. Then I had to add a second instance of the History table into my data model so I could put a 1x1 MRO on the Accomplishment tab with the other half of the History table fields. Now I can edit the data in the History table without a problem.

I hope I explained this clearly.

But I want to know why the first approach didn't work. There is something I don't understand.

Also is the use of the "Master" in a data model good, bad or indifferent? I never had something like that in building forms from scratch.

Lynn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top