新手问,VB6里面怎样调用水晶报表

解决方案 »

  1.   

    rpt1.ReportFileName = app.Path & "報表.rpt"
            rpt1.PageZoom (100)
            rpt1.WindowState = crptMaximized
            rpt1.Action = 1
      

  2.   

    dim m_app as new craxddrt.application
    dim m_rpt as craxddrt.reportm_rpt = m_app.open ("报表路径")
      

  3.   

    Dim CryApp As New CRAXDDRT.Application
        Dim Report As CRAXDDRT.Report
        
        Dim strCnn As String
        Set Report = CryApp.OpenReport(App.Path & "\report2.rpt")
        Screen.MousePointer = vbHourglass
        CRViewer91.ReportSource = Report
        CRViewer91.ViewReport
        Screen.MousePointer = vbDefault
      

  4.   

    先在部件中添加一个报表控件(crystl32.ocx),然后置报表属性
            rpt1.ReportFileName =报表名
            rpt1.datafile(0)=数据库
            rpt1.Action = 1
    运行程序即可生成报表预览
      

  5.   

    rptform!Report1.ReportFileName = ReportPath & "ryflb.rpt"
        rptform!Report1.Action = 1
      

  6.   

    补充:lihonggen0(李洪根,用.NET,标准答案来了)
    的办法在VB6 和Crystal Report9 里面的用法:引用:
    Crystal Report 9 ActiveX Designer Design And Runtime Library 和
     
    并添加Crystal Report Viewer Control 9 控件,同时,系统会自行加上同名的引用。在模块级声明:
      Dim CryApp As New CRAXDDRT.Application
        Dim Report As CRAXDDRT.Report
    然后在某一事件,如formload中:    Dim strCnn As String
        Set Report = CryApp.OpenReport(App.Path & "\report2.rpt")
        Screen.MousePointer = vbHourglass
        CRViewer91.ReportSource = Report
        CRViewer91.ViewReport
        Screen.MousePointer = vbDefault