大家有没有用过RAS或CITRIX这种远程接入技术,比VPN要快,我写了个打印程序,用的是QReport做的,通过RAS远程接入连接后,点击打印预览界面的打印机设置,提示“There is no default printer currently selected.”找不到打印机(但是远程客户端和服务器端都有装打印机),无法打印,但是程序在局域网内或本机运行打印都没有问题,而且通过微软的远程桌面也没有问题,难到会和代码写法有关吗?下面是代码,请高手给看一下,非常感谢///////////打印界面的调用命令
if MessageDlg('你是否要打印入库单?',mtConfirmation, [mbYes,mbNo],0)=mrYes then
begin
with rptinacc.F_rptinacc.ADOQuery1 do
begin
close;
sql.Clear ;
sql.Add('select * from indetail where [入库单号]=:a');
parameters.ParamByName('a').Value :=trim(self.inid.Text);
open;
active:=true;
end;
rptinacc.F_rptinacc.QuickRep1.Preview ;
end;
///////////////报表界面的代码unit RPTinacc;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, QRCtrls, QuickRpt, ExtCtrls;type
TF_rptinacc = class(TForm)
QuickRep1: TQuickRep;
QRBand1: TQRBand;
QRLabel1: TQRLabel;
QRLabel2: TQRLabel;
QRLabel3: TQRLabel;
QRLabel4: TQRLabel;
QRLabel5: TQRLabel;
QRLabel6: TQRLabel;
QRLabel7: TQRLabel;
QRDBText1: TQRDBText;
QRDBText2: TQRDBText;
QRDBText3: TQRDBText;
QRDBText4: TQRDBText;
QRDBText5: TQRDBText;
QRDBText6: TQRDBText;
QRLabel20: TQRLabel;
QRDBText14: TQRDBText;
QRLabel21: TQRLabel;
QRDBText15: TQRDBText;
QRBand2: TQRBand;
QRLabel8: TQRLabel;
QRLabel9: TQRLabel;
QRLabel10: TQRLabel;
QRLabel11: TQRLabel;
QRLabel12: TQRLabel;
QRLabel13: TQRLabel;
QRLabel14: TQRLabel;
QRLabel22: TQRLabel;
QRBand3: TQRBand;
QRSysData1: TQRSysData;
QRDBText7: TQRDBText;
QRDBText8: TQRDBText;
QRDBText9: TQRDBText;
QRDBText10: TQRDBText;
QRDBText11: TQRDBText;
QRDBText12: TQRDBText;
QRDBText16: TQRDBText;
QRBand4: TQRBand;
QRLabel15: TQRLabel;
QRExpr1: TQRExpr;
QRLabel18: TQRLabel;
QRDBText13: TQRDBText;
QRLabel19: TQRLabel;
QRSysData4: TQRSysData;
QRBand5: TQRBand;
QRSysData2: TQRSysData;
QRLabel16: TQRLabel;
QRLabel17: TQRLabel;
ADOQuery1: TADOQuery;
QRLabel23: TQRLabel;
QRExpr2: TQRExpr;
QRShape2: TQRShape;
QRShape3: TQRShape;
QRShape4: TQRShape;
QRShape5: TQRShape;
QRShape6: TQRShape;
QRShape7: TQRShape;
QRShape8: TQRShape;
QRShape1: TQRShape;
QRShape9: TQRShape;
QRShape10: TQRShape;
QRShape11: TQRShape;
QRShape12: TQRShape;
QRShape13: TQRShape;
QRShape14: TQRShape;
procedure QuickRep1BeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;var
F_rptinacc: TF_rptinacc;implementation{$R *.dfm}procedure TF_rptinacc.QuickRep1BeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
begin
adoquery1.Active :=true;
QRExpr1.Expression :='sum(ADOQuery1.入库数量)';
qrexpr2.Expression :='sum(adoquery1.不含税金额)';
end;end.
if MessageDlg('你是否要打印入库单?',mtConfirmation, [mbYes,mbNo],0)=mrYes then
begin
with rptinacc.F_rptinacc.ADOQuery1 do
begin
close;
sql.Clear ;
sql.Add('select * from indetail where [入库单号]=:a');
parameters.ParamByName('a').Value :=trim(self.inid.Text);
open;
active:=true;
end;
rptinacc.F_rptinacc.QuickRep1.Preview ;
end;
///////////////报表界面的代码unit RPTinacc;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, QRCtrls, QuickRpt, ExtCtrls;type
TF_rptinacc = class(TForm)
QuickRep1: TQuickRep;
QRBand1: TQRBand;
QRLabel1: TQRLabel;
QRLabel2: TQRLabel;
QRLabel3: TQRLabel;
QRLabel4: TQRLabel;
QRLabel5: TQRLabel;
QRLabel6: TQRLabel;
QRLabel7: TQRLabel;
QRDBText1: TQRDBText;
QRDBText2: TQRDBText;
QRDBText3: TQRDBText;
QRDBText4: TQRDBText;
QRDBText5: TQRDBText;
QRDBText6: TQRDBText;
QRLabel20: TQRLabel;
QRDBText14: TQRDBText;
QRLabel21: TQRLabel;
QRDBText15: TQRDBText;
QRBand2: TQRBand;
QRLabel8: TQRLabel;
QRLabel9: TQRLabel;
QRLabel10: TQRLabel;
QRLabel11: TQRLabel;
QRLabel12: TQRLabel;
QRLabel13: TQRLabel;
QRLabel14: TQRLabel;
QRLabel22: TQRLabel;
QRBand3: TQRBand;
QRSysData1: TQRSysData;
QRDBText7: TQRDBText;
QRDBText8: TQRDBText;
QRDBText9: TQRDBText;
QRDBText10: TQRDBText;
QRDBText11: TQRDBText;
QRDBText12: TQRDBText;
QRDBText16: TQRDBText;
QRBand4: TQRBand;
QRLabel15: TQRLabel;
QRExpr1: TQRExpr;
QRLabel18: TQRLabel;
QRDBText13: TQRDBText;
QRLabel19: TQRLabel;
QRSysData4: TQRSysData;
QRBand5: TQRBand;
QRSysData2: TQRSysData;
QRLabel16: TQRLabel;
QRLabel17: TQRLabel;
ADOQuery1: TADOQuery;
QRLabel23: TQRLabel;
QRExpr2: TQRExpr;
QRShape2: TQRShape;
QRShape3: TQRShape;
QRShape4: TQRShape;
QRShape5: TQRShape;
QRShape6: TQRShape;
QRShape7: TQRShape;
QRShape8: TQRShape;
QRShape1: TQRShape;
QRShape9: TQRShape;
QRShape10: TQRShape;
QRShape11: TQRShape;
QRShape12: TQRShape;
QRShape13: TQRShape;
QRShape14: TQRShape;
procedure QuickRep1BeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;var
F_rptinacc: TF_rptinacc;implementation{$R *.dfm}procedure TF_rptinacc.QuickRep1BeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
begin
adoquery1.Active :=true;
QRExpr1.Expression :='sum(ADOQuery1.入库数量)';
qrexpr2.Expression :='sum(adoquery1.不含税金额)';
end;end.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货