unit uSelectPrint;  //用于用户选择需打印的字段interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, DB, DBClient;type
  TfrmSelectPrint = class(TForm)
    GroupBox1: TGroupBox;
    checkb_khjg: TCheckBox;
    checkb_hm: TCheckBox;
    checkb_zh: TCheckBox;
    checkb_xdmm: TCheckBox;
    checkb_sfzh: TCheckBox;
    checkb_dzpzmm: TCheckBox;
    checkb_tkmm: TCheckBox;
    checkb_jrkmm: TCheckBox;
    checkb_myemail: TCheckBox;
    checkb_bgxhm: TCheckBox;
    checkb_jgurl: TCheckBox;
    checkb_khsj: TCheckBox;
    checkb_yyyxm: TCheckBox;
    checkb_yyydh: TCheckBox;
    checkb_yyysj: TCheckBox;
    checkb_other1: TCheckBox;
    checkb_yzty: TCheckBox;
    checkb_bz: TCheckBox;
    btn_next: TBitBtn;
    BitBtn1: TBitBtn;
    ClientDataSet1: TClientDataSet;
    procedure BitBtn1Click(Sender: TObject);
    procedure btn_nextClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  frmSelectPrint: TfrmSelectPrint;implementationuses uPrint;{$R *.dfm}procedure TfrmSelectPrint.BitBtn1Click(Sender: TObject);
begin
  close;
end;procedure TfrmSelectPrint.btn_nextClick(Sender: TObject);
begin
   frmprint:=Tfrmprint.Create(nil);
   try
      frmprint.QuickRep1.PreviewModal;      //调用的时候出错
   finally
     frmprint.Free;
   end;
    self.ModalResult:=MROK;
    close;
end;end.出错:  Access Violation at address 004dec92 in module 'account.exe',Read of address 0000000.
  好像是quickrep1没有创建,不知道怎么做?谢谢。

解决方案 »

  1.   

    我用时也是出错,只好采用了静态装载的方式!
    Project->Optiopn->Forms,然后把你的frmprint弄到左边!
    直接frmprint.QuickRep1.PreviewModal;调用就可以了!
      

  2.   

    procedure TfrmSelectPrint.btn_nextClick(Sender: TObject);
    begin
       frmprint:=Tfrmprint.Create(nil);
       try
          frmprint.QuickRep1.PreviewModal;      //调用的时候出错
       finally
         frmprint.Free;
         frmprint:=nil;
       end;
        
    end;