veyant
22nd July 2004, 06:23
Hi ,

I am facing a very strange problem. pls advice.

I created a main session having a subsession for recording lines and data is saved in two different tables (Header & Lines Table) with Order # as link field.

it is a type main table session. Now if i delete record from header form and lines are presnt for that order it gives error.

so lines are required to be deleted first. So i click on lines button and lines subsession opens and if i delete records from there. It is fine. Now when i come back to the main session and try to delete the Header it gives "Error 206 - Record is not locked" and record is deleted and session terminates automatically. Now if i rerun the same session and select the same order and press delete button. it deletes the record with any error.

Please advice why it is giving error in first go when i deleted the lines and then i try to delete header.

However, i have not written any code for deleting in both sessions (header & lines). as it is session with Main table so it is executing execute(mark.delete) itself.

thanks
Sandy

mark_h
22nd July 2004, 14:27
It sounds like a transaction was started and not cleared. You might need to either write code to trap the error before the transaction or code to clear the current transaction. I usually trap the error and do a choice.again().

Mark

toolswizard
25th July 2004, 14:56
Can you supply the code you use to zoom to the lines session?

lbencic
26th July 2004, 16:12
Also check your table relations - are these custom header and lines tables?. Is it possible that you have the mode set on your delete reference mode from your Lines Order # to your Header Order # such that it is causing problems. (Or, maybe you made it from header to lines and that is causing the problem?) What are the references and reference modes set to on the tables? Check header and lines.

veyant
26th July 2004, 18:05
I have not set reference on deletion in tables. these are customized taables. I other strange thing which i observed is that after deleting lines from subsession if i press save and then come back to main session and try to delete header. it works fine and gives no error. But if i have not pressed save button before coming out of subsession after deleting lines, it gives Error 206 if i try to delete Header Record.

lbencic
26th July 2004, 18:47
I agree with toolswizard then - can you post how you do the zooming.
When you say 'when I delete from the header and lines are present i get an error'. Is that error coded by you? Or coming from the DB?
Any code you can post would help us get a picture.

fosterjr
26th July 2004, 19:49
Are these new tables? If so you should add references to them.
In Maintain Table Definitions, Click on fields. Go to the detail for the fields and enter a reference table. In your case, Maintain Table definitions for your lines table, for the order field reference your order header table. I would set the reference mode to "mandatory" Once you have the reference created, I would go back to the header table and set the delete mode to either "Child will be deleted" or "Restricted" Don't forget to run your Convert to Runtime Data Dictionary with the reconfigure flag set. Then log out and back in.

I have not set reference on deletion in tables. these are customized taables. I other strange thing which i observed is that after deleting lines from subsession if i press save and then come back to main session and try to delete header. it works fine and gives no error. But if i have not pressed save button before coming out of subsession after deleting lines, it gives Error 206 if i try to delete Header Record.