加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

vb制作报表(曾经站位)

发布时间:2020-12-16 22:49:53 所属栏目:大数据 来源:网络整理
导读:第一步:下载安装grid++report ( 下载grid++report ) 第二步:创建报表模板。 ( 如何制作报表模板 ) 第三步:添加应用和部件(部件 :和 引用:) 第四步:用VB将报表连接起来。(报表的位置app.path最方便 ) Dim WithEvents Report As grproLibCtl.Gridp

第一步:下载安装grid++report (下载grid++report)

第二步:创建报表模板。 (如何制作报表模板

第三步:添加应用和部件(部件 :和 引用:)

第四步:用VB将报表连接起来。(报表的位置app.path最方便 )

Dim WithEvents Report As grproLibCtl.GridppReport

Private Sub cmdPre_Click()
    Report.PrintPreview (True)
End Sub

Private Sub cmdPrint_Click()
   '因为报表对象的 Print 方法名与 VB 内部定义有冲突,所以要用中括号括起来
    Report.[Print] (True)
End Sub

Private Sub Command1_Click()
        GRDisplayViewer1.Refresh
End Sub

Private Sub Form_Load()
    '创建报表对象
    Set Report = New grproLibCtl.GridppReport
    '载入报表模板文件
    Report.LoadFromFile ("C:UsersHAIFANGDesktop机房收费系统1.0byDay.grf") '
    strTxtSQL = "select * from allbyday_tableInfo where date='" & Format(Now,"yyyy-mm-dd") & "'"
  '设置数据连接串
    Report.DetailGrid.Recordset.ConnectionString = "FILEDSN=computerChargeSys.dsn;UID=sa;PWD=123456"
    Report.DetailGrid.Recordset.QuerySQL = strTxtSQL
    
    GRDisplayViewer1.Report = Report
    GRDisplayViewer1.Start
    
    
End Sub
 
Private Sub Form_Resize()
    GRDisplayViewer1.Left = 0
    GRDisplayViewer1.Width = Me.Width - 500
End Sub

Private Sub Report_Initialize()

    '设置各个参数的值
                          
    Report.ParameterByName("makedate").AsString = Format$(Date,"yyyy-mm-dd")    '显示开始日期
'    Report.ParameterByName("DateEnd").AsString = Format$(DTPEnd.Value,"yyyy-mm-dd")        '显示结束日期
'
End Sub

在报表GridReport中显示日期时间的改变: http://www.52php.cn/article/p-bwkaymyg-ts.html

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读