Hi, I just created a command button on the Sales Invoice, and what it will do is it is going to insert new record to the Sales Header and Sales Line tables. Anyway, I could get the new records inserted to the tables with no problem. Nevertheless, it will never display on the Salve Invoice form. I tried all the form functions for “CurrForm”, but none of them works. Any ideas? Here is the code on the command button: Zero := 0; CurrMonth := DATE2DMY(WORKDATE,2); CurrYear := DATE2DMY(WORKDATE,3); Selection := STRMENU(‘Training and Consultancy,License,cancel’,3); CASE Selection OF 1: BEGIN IF CONFIRM(‘Are you sure the Invoice Type is Training and Consultancy?’,FALSE) THEN BEGIN NoSeriesLine.SETFILTER(“Order of Month”,’%1’,NoSeriesLine.“Order of Month”::Prefix); IF NoSeriesLine.FIND(’-’) THEN BEGIN NewNo := NoSeriesMgt.GetNextNo(NoSeriesLine.“Series Code”,WORKDATE,TRUE); SalesHeader.INIT; SalesHeader.“Document Type” := SalesHeader.“Document Type”::Invoice; SalesHeader.“No.” := NewNo; SalesHeader.“Document Date” := WORKDATE; SalesHeader.“Posting Date” := WORKDATE; SalesHeader.“Shipment Date” := WORKDATE; SalesHeader.INSERT; END END ELSE EXIT; END; 2: BEGIN IF CONFIRM(‘Are you sure the Invoice Type is License?’,FALSE) THEN BEGIN NoSeriesLine.SETFILTER(“Order of Month”,’%1’,NoSeriesLine.“Order of Month”::Suffix); IF NoSeriesLine.FIND(’-’) THEN BEGIN NewNo := NoSeriesMgt.GetNextNo(NoSeriesLine.“Series Code”,WORKDATE,TRUE); IF CurrMonth <10 THEN BEGIN SalesHeader.INIT; SalesHeader.“Document Type” := SalesHeader.“Document Type”::Invoice; SalesHeader.“No.” := NewNo + ‘-’ + FORMAT(Zero) + FORMAT(CurrMonth); SalesHeader.“Document Date” := WORKDATE; SalesHeader.“Posting Date” := WORKDATE; SalesHeader.“Shipment Date” := WORKDATE; SalesHeader.INSERT; END ELSE BEGIN SalesHeader.INIT; SalesHeader.“Document Type” := SalesHeader.“Document Type”::Invoice; SalesHeader.“No.” := NewNo + ‘-’ + FORMAT(CurrMonth); SalesHeader.“Document Date” := WORKDATE; SalesHeader.“Posting Date” := WORKDATE; SalesHeader.“Shipment Date” := WORKDATE; SalesHeader.INSERT; END END; END ELSE EXIT; END; 3: BEGIN MESSAGE(‘No option is selected.’); EXIT; END; END; Thank you for the attention. Sincerely, Sylvia Tsang Management Software Solutions, Inc. stsang@mgmtsoftware.com
Hi Sylvia, you say that the the record(s) will be inserted but you have problems to show it on the form, correct ? If this is your problem, then the code you showed here is no real help. Your code shows the steps until a salesheader-record wil be inserted and then…? I asume salesheader is a defined record-variable and not the actual rec? Be sure that form runs with the correct rec. If this is the case, then examine the filters on the form-properties and the record. Micha
Change SalesHeader.INSERT ==> SalesHeader.INSERT(TRUE) Goodluck…
Hi, I got the program working already. But anyway, thank you for the inputs. Sincerely, Sylvia Tsang Management Software Solutions, Inc. stsang@mgmtsoftware.com