当前位置: 代码迷 >> 报表 >> 机房收费系统之表格总结2
  详细解决方案

机房收费系统之表格总结2

热度:160   发布时间:2016-05-05 07:37:11.0
机房收费系统之报表总结2

 

在上一篇中已经说了如何构建报表模板,接下来就是用vb调用报表模板以此来实现报表的输出。下面是一些具体的过程:

 

’定义报表Dim Report As grproLibCtl.GridppReportPrivate Sub cmdPrint_Click()‘打印报表    Report.[Print] (True)End Sub Private Sub cmdPrintPreview_Click()’打印预览    Report.PrintPreview (True)End SubPrivate Sub cmdRefresh_Click()‘刷新报表    txtSQL = "select * from daybill_Info where daydate='" & Format(Date, "yyyy-mm-dd") & "'"    Report.DetailGrid.Recordset.QuerySQL = txtSQL    GRDisplayViewer1.RefreshEnd SubPrivate Sub Form_Load() '将日结账单以报表形式显示出来    '建立查询语句    txtSQL = "select * from daybill_Info where daydate='" & Format(Date, "yyyy-mm-dd") & "'"    '创建报表对象    Set Report = New grproLibCtl.GridppReport    '载入报表模板文件    Report.LoadFromFile (App.Path & "\报表\日结账单1.grf")    '设置数据连接串    Report.DetailGrid.Recordset.ConnectionString = ConnectionString()    '载入查询语句    Report.DetailGrid.Recordset.QuerySQL = txtSQL    '显示报表中的内容    GRDisplayViewer1.Report = Report    GRDisplayViewer1.StartEnd Sub

 

而在周结账单中只要引进参数即可:

'设置报表参数

    Report.ParameterByName("datestart").AsString = Str(startTime.Value)

    Report.ParameterByName("dateend").AsString = endTime.Value

 

  相关解决方案