如题,是否和在4.6中一样,先建一个表再在VB中调用打印即可??

解决方案 »

  1.   

    With CrystalReport1
                   .WindowShowPrintSetupBtn = True
                   .Connect = getConnectDSN   '连接的数据库
                   .SQLQuery = SelectSQL
                   .ReportFileName = App.Path & "\report\*.rpt"
                   .Formulas(0) = "printname= '" + LoginName + "'"
                   .Formulas(1) = "rq1= '" + m + "'"
                   .Formulas(2) = "rq2= '" + n + "'"
                   .WindowState = crptMaximized
                   .PageZoom 100
                   .PrintReport
                   .Reset
                   End With
      

  2.   

    大哥,我安装完在vb中根本就无法加入一个水晶报表控件(crystal report control),是不是我还有什么没安装的????
      

  3.   

    安装水晶报表后,VB中应该“工程”菜单下有一个“添加crystal report ”这么一项。
    在引用部件中,选中“crystal report Viewer Control 9”
      

  4.   

    安装水晶报表后,先在“工程”菜单下引用“crystal report Viewer Control 9”然后添加  “crystal report Viewer Control 9”这个部件。然后写下如下代码:
      Dim cry As New CRAXDDRT.Application
      Dim rep As New CRAXDDRT.Report
      Set rep = cry.OpenReport(App.Path & "\文件名.rpt")
      CRViewer91.ReportSource = rep
      CRViewer91.GetCurrentPageNumber
      CRViewer91.ShowNextPage
      CRViewer91.ViewReport
      

  5.   

    在fsysky(风沙雨)的回复中,
    Set rep=cry.OpenReport(App.Path & "\文件名.rpt") 该为:
    Set rep=cry.OpenReport("水晶报表模板保存的路径\模板文件名.rpt")
    若不改,则应该把保存的水晶报表模板移到工程所在的文件夹去。