I have add a field to the Sales Line table and Subform 46 called "Sample". Upon clicking this field it inserts a second line based on the current line (using Line No., Item No. and Qty). I want the second line to be the current line no. + 1. You can probably guess that due to Autsplit and DelayedInsert my original line might not have a line no. yet so I can't increment the new line no. + 1 since it would always = 1.
How can I force the current line to insert so it gets a line no. before inserting the second line. Please note this is not the same as the Temporary Dimension stuff used on Sales and Purchase Subforms. I understand how that works and does not solve my problem.
0
Answers
But what is the benefit of your solution.
Why you can't insert first, mark the line you want to "copy" and push a button or call a function who generate the same line +1 (normally +10000)?
To your solution:
Otherwise you can try to get the last no. with a temp record or second record on the Sales Line for find die last line in the Sales Line with your relvant filters.
If you find it, use "Line No" +10000 + 1.
Then you get die "Line No." for the current Line, that are not inserted yet and die copy line.
came
Do all your coding on the record level, not on the form level, except that you might want to do a CurrForm.UPDATE(TRUE) in the OnAfterValidate trigger if a Sample-line has just been inserted.
My first attempt was to do the coding on the Form, using the OnValidate trigger of the "Sample" control. But saving the record using CurrForm.SAVERECORD strangely inserted the new line in the wrong place (I had one line with Line No. 10000, and instead of inserting as 20000 it got inserted as 5000).
The solution that worked perfectly for was to put all the code on the Form OnAfterValidate Trigger. At the very top you must do a Currform.saverecord (now the line no. is finally populated), then the code to insert the second sales line followed by a currform.update(true) to allow the new sales line to show immediately.
jwilder@stonewallkitchen.com
can u please explain me with code...