报表

Option Explicit

Dim WithEvents Report As grproLibCtl.GridppReport   ‘声明 report 具有报表控件的事件

Dim starttime As Date

Dim endtime As Date

 

Private Sub cmdpreview_Click()

  Report.PrintPreview (True)   报表预览

End Sub

 

Private Sub cmdprint_Click()

Report.[Print] (True)           ‘打印报表

End Sub

 

Private Sub cmdrefresh_Click()

  Dataview.Stop                               ‘刷新报表

  Set Report = New grproLibCtl.GridppReport       ‘实例化一个报表

  Report.LoadFromFile (App.Path & "/ 客户基本信息 .grf")  ‘加载报表文件

  Report.DetailGrid.Recordset.connectionstring = "filedsn=andy.dsn;UID=sa;pwd=123456" 

‘建立连接,也可以在创建报表的时候

  Report.DetailGrid.Recordset.QuerySQL = "select * from daily_account where daily_time between '" & starttime & "' and '" & endtime & "'"  ‘报表查看的内容

  Dataview.Report = Report       ‘查看报表

  Dataview.Start                ‘开始显示

 

End Sub

 

你可能感兴趣的:(report,报表)