vb报表(二)——打印报表
报表显示:
Private Sub Form_Load() Dim WithEvents report As grproLibCtl.GridppReport '实例化报表 Set report = New grproLibCtl.GridppReport '报表建立的位置 report.LoadFromFile (App.Path & "\CheckDay.grf") '和数据库连接 report.DetailGrid.Recordset.ConnectionString = "FileDSN=chargeroom.dsn;uid=sa;pwd=123456" '数据源 '查询表 txtSQL = "select * from CheckDay_Info" '把记录查询出来,显示在报表里 report.DetailGrid.Recordset.QuerySQL = txtSQL '查看报表 GRDisplayViewer1.report = report GRDisplayViewer1.Start End Sub
打印:
report.[Print] (True)
打印预览:
report.PrintPreview (True)