I have a subform which contains a list of payments and dates. When the user proceeds to the next blank line on my subform, I populate the payment amount with the amount from the preceeding line and the date from the preceeding line plus 1 month … as follows :
IF BelowxRec THEN
BEGIN
IF (xRec.“Posting Date” <> 0D) AND (xRec.Amount <> 0)
AND (TotalLineAmount < PrepaymentHeader.“Prepayment Amount”) THEN
BEGIN
RemainingAmount := PrepaymentHeader.“Prepayment Amount” - TotalLineAmount;
“Posting Date” := CALCDATE(‘1M’,xRec.“Posting Date”);
IF xRec.Amount <= RemainingAmount THEN
Amount := xRec.Amount
ELSE
Amount := RemainingAmount
END;
END;
TotalLineAmount is a running total of the lines on the subform. This gets updated by the OnInsertRecord, OnModifyRecord and OnDeleteRecord triggers. PrepaymentHeader.“Prepayment Amount” is the maximum allowable value for TotalLineAmount, read from the mainform Sourcetable.
The code works, up to a point. When the user moves down to a blank line, the date and amount fields are populated correctly. But then the user cant proceed to create any more lines. The new line never gets inserted. If the user moves back up to the previous line, the newline disappears.
MultipleNewLines doesnt help …
Does anyone know what would help ?