【机房管理】报表1

来源:互联网 发布:mysql 字符串转时间 编辑:程序博客网 时间:2024/05/09 01:10

第一步,建立报表。

插入页眉页脚、报表头、报表尾、明细网格


点击设置数据源





选择与自己相关的文件




也可以从插入中点击明细列,明细字段



或者

综合文字框:是与VB连接而用到的一个文字框,(如我们作品展是用到的FLash 与 VB的交互)道理是一样一样

还有更多好玩的东西等待着大家发现……


第二步……

说起来也是伤心,我觉得应该有第二步,但是吧,不知道第二步是啥,在以后的博客中也许会更新,敬请期待(也许根本就没有第二步,你说呢?)


第三步编写代码:

使报表和VB链接

Dim WithEvents Report As grproLibCtl.GridppReport      '实例化报表txtSQL = "select * from CheckDay_Info where date='" & Format(Date, "yyyy-mm-dd") & "'"        Set Report = New grproLibCtl.GridppReport  '实例化报表        Report.LoadFromFile (App.Path & "\checkday.grf") '加载报表模板文件        Report.DetailGrid.Recordset.ConnectionString = ConnectString()     '连接数据源'     Report.DetailGrid.Recordset.ConnectionString = "FileDSN=charge.dsn;uid=sa;pwd=123456"        Report.DetailGrid.Recordset.QuerySQL = txtSQL                     '通过select查询创建记录集    Report.ParameterByName("guanliyuan").Value = UserName            '显示管理员    Report.ParameterByName("caozuoyuan").Value = UserName '显示操作员编号    GRDisplayViewer1.Report = Report                             '将数据赋给GRD的report    GRDisplayViewer1.Start

其他

Private Sub Command1_Click() '日结账单刷新      GRDisplayViewer1.Refresh      MsgBox "账单刷新成功!", vbOKOnly + vbExclamation, "提示"End Sub
Private Sub Command2_Click()     '打印,因为报表对象的print方法名与vb的内部定义方法有冲突所以要用中括号      Report.[Print] (True)End Sub
Private Sub Command3_Click()    '打印预览     Report.PrintPreview (True)End Sub



原创粉丝点击