我刚学了两个星期的DELPHI,编程这一块还是一片空白,请各位大侠多多指教,客户明天就来检查了,很急
楼上的漏掉了数据库的调用
现在的程序是这样的:
不同的按钮(处于不同的窗体之中)
procedure TjjbF.BitBtn7Click(Sender: TObject);
begin
if printform=nil then
printform:=tprintform.Create(application);
printform.Show;
end;
procedure TpdsrbF.BitBtn3Click(Sender: TObject);
begin
if printform=nil then
printform:=tprintform.Create(application);
printform.Show;
end;
同一个TfrReport控件(调用的代码全部都在此窗体,偶就是不知道怎么实现)
frReport1:TfrReport1
fp:TfrPreview
不同的报表(已经做好模板)
adoquery1.Close;
adoquery1.SQL.Text:='select * from ajjbjl where jjbsj='''+jjbf.jjbsj.Text+'''';
adoquery1.Open;
frreport1.Preview:=fp;
frreport1.LoadFromFile(ExtractFilepath(application.ExeName)+'打印模板/交接班打印.frf');
frreport1.PrepareReport;
frreport1.ShowReport;
adoquery1.Close;
if pdsrbf.adoquery1.Filter<>'' then
adoquery1.SQL.Text:=adoquery1.SQL.Text+' where '+pdsrbf.adoquery1.Filter
else
adoquery1.SQL.Text:=adoquery1.SQL.Text;
adoquery1.Open ;
adoquery1.Sort:='rq ,sm ';
frreport1.Preview:=fp;
frreport1.LoadFromFile(ExtractFilepath(application.ExeName)+'打印模板/配电所日报.frf');
frreport1.PrepareReport;
frreport1.ShowReport;
谢谢各位了,