//Query窗口报表Button
procedure TfrmQuery.CreateReport(Sender : TObject);
begin
with TfrmReport.Create(Application)do
begin
qlDateRange.Caption:=datetostr(dp_Start.Date)+' '+timetostr(tp_start.Time)+
' 至 '+datetostr(dp_end.
Date)+' '+timetostr(tp_end.
Time);
qr_Report.Preview;
end;
end;
//report的OnPreview(多个表用同一个)
procedure TfrmReport.ReportPreview(Sender : TObject);
begin
with TfrmPreview.Create(Application)do
begin
QRPreview.QRPrinter:=TQRPrinter(Sender);
CurRep:=TQuickRep(sender);
Show;
end;
end;
//Preview的Formclose;
procedure TfrmPreview.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
CurRep := nil;
Action := caFree;
end;
//Report的FormClose;
procedure TfrmReport.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=caFree;
end;
在frmpreview中未执行打印时一切正常