Hello,
can anyone help me please, I have created a command button and within the onPush trigger i have inserted the following code to copy across certain fields from the sales order to another form (build schedule) however it doesn't seem to be working it creates a new record within the new form but all the fields are blank:
SalesHeader.SETRANGE("Document Type", "Document Type"::Order);
SalesHeader.SETRANGE("No.", SalesLine."Document No.");
SalesLine.SETRANGE(SalesLine.Type, SalesLine.Type::ITEM);
IF (SalesLine.FIND('-')) AND (SalesLine."To Build" = TRUE) THEN BEGIN
BuildSchHead.INIT;
SalesHeader."No." := BuildSchHead."Sales Order No.";
SalesHeader."Bill-to Name" := BuildSchHead."Customer Name";
REPEAT
BuildSchLine."Item No." := SalesLine."No.";
BuildSchLine.Description := SalesLine.Description;
BuildSchLine.Qty := SalesLine.Quantity;
BuildSchHead.INSERT(TRUE);
UNTIL BuildSchLine.NEXT = 0;
END;
MESSAGE('Build Schedule %1 has been created',BuildSchHead."No.");
Any ideas please?
0
Comments
http://ssdynamics.co.in
This is your old source:
This is the new source (i hope the Button is on the Sales Order Form and not in the subform):
Regards
I seem to be having problems with getting the record to modify of it exists, the code i have added is as follows; I have also tried IF NOT INSERT THEN MODIFY, but that does not work either?
see the comment, i don't know if this is the problem, as i didn't read carefully your code, but it is potentially a serious bug, if i'm right
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
have you really got a line that have "build no." = 'build no." and "item no." = 'item no.'?! :shock:
i don't think so, maybe you want to do anyway, i don't think this will make your application work correctly, there are some other problems in the code.
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
This should be correct, (what is the "rec"?) you should check the GET function in the online help
hope to be helpful
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog