我有一个分类帐条目表,我正在遍历它查找差距,然后将它们保存在file.txt中,但它仅适用于最后一个间隙,如何将所有结果保存在我的文件中?
IF LibraryLedgerEntry.FINDLAST THEN
LastEntryNo := LibraryLedgerEntry."Entry No.";
IF LastEntryNo <> 0 THEN BEGIN
FOR i := 1 TO LastEntryNo DO BEGIN
LibraryLedgerEntry.RESET;
LibraryLedgerEntry.SETRANGE("Entry No.",i);
IF NOT LibraryLedgerEntry.FINDFIRST THEN BEGIN
REPEAT
MyFile.CREATE('C:\MyNewFolder\MyWriteText.txt');
MyFile.CREATEOUTSTREAM(OutStreamObj);
OutStreamObj.WRITETEXT(FORMAT(i));
OutStreamObj.WRITETEXT();
UNTIL LibraryLedgerEntry.NEXT = 0 ;
MyFile.CLOSE;
END;
END;
END;