If you are inserting via code, you have to assign the Line Number yourself. Only informs (with property “AutoSplitKey” set) the Line Number is assigned automatically.
I am Inserting via code only , into the another Table.
But, our Client Select the Item No. Twice. in the same Order. For that Filter. Am tryiing to insert the Sales line No. In the New table along with Item Number.
The problem here is the DelayedInsert-property of the Sales Order Subform.
The line is not inserted at the time the user enters the Item No., and therefore also has no Line No. assigned yet.
If you want to force the insert, you can use the CurrForm.SAVERECORD command, prior to where you want to insert the record in the other table.
But you have to test thoroughly that this will NOT cause other problems, to insert the record earlier than expected.
As Alexander says, the problem is in the DelayedInsert property.
An other solution which I would advise is to add to table 37 a function which writes the record in your table. The function should exit doing nothing if any of the fields you need (such as “Line No.”, Type, “No.”, ecc…) is not filled in the variable Rec. Call the function in the OnInsert and OnModify triggers.
Please, if any of the replies to your post solved your problem, then please click on the “Verify solution” next to that post. This way we can see that your post is closed and you got the help you needed. If you found another solution to your problem, then please, out of courtisy to the members who helped you here, post the solution here.
Sorry, it seems I missed your request for clarifying. Yes I meant that the function which inserts data in your table should be called in Sales Line OnInsert and OnModify triggers.