Hi,
I have added a function to insert an item code into a new sales line from the sales order form. Basically the user moves t oa new line, hits F10 and then is presented with a filtered list of items. (I can’t use the normal “no.” field lookup).
The problem is, however , that when the user selects the item required and returns to the sales order, the new line has been inserted correctly at the bottom of the current sales lines but the system sets the record pointer to the first line. How do I get it to select (set the pointer) the line I have just inserted?
The F10 function on the main form calls a function on the subform…
CurrForm.SalesLines.FORM.GetPriceListItem;
… which in turn calls a function to insert the new item line.
I don’t want to create a new record as soon as the user moves to a blank line so any ideas would be much appreciated.
Regards,
Tim
Hi Tim
Have you tried to insert
IF FIND(‘+’) THEN;
In the end of you function?
Regards
Claus
Hi Tim
I just made a little test and you will have to put a CurrForm.UPDATE(FALSE) after the FIND(’+’)
IF FIND(’+’) THEN;
CurrForm.UPDATE(FALSE);
Regards
Claus
Hi Claus,
I wrote some messy coding, to create a new line before calling the function, that did work OK;
//TDS45165-2 >>
IF “Line No.” = 0 THEN
BEGIN
SalesLine.INIT;
SalesLine.“Document Type” := SalesHeader.“Document Type”;
SalesLine.“Document No.” := SalesHeader.“No.”;
SalesLine.Type := SalesLine.Type::Item;
SalesLine2.RESET;
SalesLine2.SETRANGE(“Document Type”,SalesHeader.“Document Type”);
SalesLine2.SETRANGE(“Document No.”,SalesHeader.“No.”);
IF SalesLine2.FIND(’+’) THEN
SalesLine.“Line No.” := SalesLine2.“Line No.” + 10000
ELSE
SalesLine.“Line No.” := 10000;
Rec := SalesLine;
CurrForm.SAVERECORD;
COMMIT;
END;
//TDS45165-2 <<
SalesPriceCalcMgt.GetSalesLinePriceListItem(SalesHeader,Rec);
… but I like your solution better. Thanks very much for your time. I guess it’s easy when your clever[:)]
Regards, Tim