Normal Topic Form locked (Read 2978 times)
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Form locked
Dec 23rd, 2004 at 2:55am
Print Post Print Post  
Somehow I have created a situation that locks a form when in the UPDATE mode. 

The main Orders form has two Line Item subforms, both are Table View.
In @ADD mode, Subform A is visible, Subform B is invisible.
In @UPDATE mode, Subform A is invisible, Subform B is visible.

In @ADD mode, all is well, Can create new record with multiple line items in subform

In @UPDATE mode, main form is locked. Yellow Mode indicator shows LOCKED status. 

Can make changes to fields in subform, but values in the first record only are not saved.  Records 2 and subsequent accept the changes, and are saved.  Making these changes undoes the Locked status and all lines after the first are saved.

I suspect that this is related to focus changing from main form to sub form and triggering of events on both forms on Entry/Exit. 

Thoughts, suggestions, answers?


  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Form locked
Reply #1 - Dec 23rd, 2004 at 3:44pm
Print Post Print Post  
Hello Bob,

In Update Mode the Main record is not locked, it is the first subform record that is locked. One way to see this is to change the contact element on the main form. After you advance and the retreat you will see that the change stays.

The First SubRecord is locked because frmPoLinesAdd, your other subform, currently has that record loaded.  This is a common problem when you have two subforms on the same main form displaying the same set of records.

Have a Happy Holiday Season,
Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Form locked
Reply #2 - Dec 23rd, 2004 at 5:38pm
Print Post Print Post  
Good news is that you have identified the cause of the "common problem". 

And what is the "common solution"? 
Cannot have multilple subforms to the same database?
Cannot have common fields on the multiple subforms?
Is there a method to SetFocus, or unload FormA so FormB does not have a conflict?

  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Form locked
Reply #3 - Dec 23rd, 2004 at 6:48pm
Print Post Print Post  
Let me see if I can organize this.

Main form opens, opening SubFormA, record1.
Opening record1 with SubFormA locks Record1 on the sub form .
Main form continues and opens SubFormB, record1.  Because this is the same record that was open in SubFormA, then I get a Locked condition.

So, if SubformA, record1 was not in the records called up with SubFormB, I would not have this problem. .......
So if SubformA could be forced to always have the same record come up as record1, and SubFormB could call up all records except the record in SubFornA, then I should not have that conflict......
So, if I could create default Retrieve specs for both SubForms, I might be able to overcome this.....

Or have record1 be a dummy record that I don't care about and Set Focus immediately to Record2 when entering SubFormB.

Hmmmmm, how far off base am I?  Think any of this is possible or will I be wasting my time to try to do that?
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Form locked
Reply #4 - Dec 23rd, 2004 at 8:13pm
Print Post Print Post  
Quote:
Good news is that you have identified the cause of the "common problem". 


I believe that Ray meant "common" in the sense of shared - not in the sense of frequent.

Quote:
And what is the "common solution"?

If you have two forms both sharing the same data source record, one of them must be locked, just as if you had them open on different clients. The locking in Sesame is first come first serve.

Quote:

Cannot have multilple subforms to the same database?

Same database is fine - but two forms trying to access the same record simultaneously is a problem. One or the other has to "own" that record. Without locking you could easily have data overwrite, especially if this is a programmed database.

Quote:
Cannot have common fields on the multiple subforms?

See above.

Quote:
Is there a method to SetFocus, or unload FormA so FormB does not have a conflict?

Yes, in programming there are a number of commands that set focus, move focus, and much more to the point - advance records.

Record locking is a necessary and important part of data integrity. Anything that bypasses it or "works-around" it, should be done with the utmost care.

What is the end-user requirement you are trying to fulfill? It may well be that the best solution is to use programming to the transfer the record data to a separate set of LEs that are not themselves "sourced" to the same record or database as the original form's LEs. That way, the original form acts a secondary "source" of the data, and programming can be used to decide, on a case by case basis, what data is shown (and how) and commited.

This can be accomplished by using either the string array commands along with the generic LE access functions to glean the form data from the invisible form and cycle its records and storing the data in the Global Code area, or by deriving the data directly from the invisible form at each advance, writing the resulting user input back to the form before advancing. If the data, in either case, can be displayed "read only", I would recommend that you use static LEs and display the data through assignment of the static.

If you absolutely must use two forms that are both sourced to the same database, and there is a large possibility that both will display the same record at the same time, yes - you must either live with some record locking, or the programmer must control the advancing of either one of the two forms in relation to the other. There is no command in Sesame that will allow two (or more) points of data entry to write to the same record at the same time.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Form locked
Reply #5 - Dec 23rd, 2004 at 8:51pm
Print Post Print Post  
Thanks for the suggestions on alternatives, Mark.

I think that the solution this case may be a clone of the Main Form, ending up with two versions.  One wth SubformA, and the other with Subform B.   Only trouble with that is duplicating changes on both if the Main Forms and keeping them both in perfect sync.

At least I have a few options to work on.

Thanks again for the help,

Have a Merry Christmas .
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged