水晶报表,求助,第一次能显示出结果,第二次显示时,程序就崩掉了。
Private Sub 企业目录_Click()
RPTVarReportName = "v_c_rpt_CHInfo"
RPTVarSql = "SELECT * FROM v_c_rpt_CHInfo"
RPTFormCaption = "企业目录"
FrmCRpt.Show vbModal
End Sub
Dim Sql As String
Dim CryApp As New CRAXDDRT.Application
Dim Report As CRAXDDRT.Report
Dim rs As New ADODB.Recordset
Private Sub Form_Load()
Me.Caption = "报表--" & RPTFormCaption
'
FrmCRpt.WindowState = 2
Screen.MousePointer = vbHourglass
Set Report = CryApp.OpenReport(App.Path & "\print\" & RPTVarReportName & ".rpt")
CRViewer91.ShowPreviousPage
Sql = RPTVarSql
rs.Open Sql, conn, 1, 1
Report.Database.SetDataSource rs
'Report.PrintOut
'CRViewer91.ActivateView = 1
CRViewer91.ReportSource = Report
CRViewer91.ViewReport
CRViewer91.Zoom 100
'CrystalReport1.Destination = 1 'Send to Printer
' CRViewer91.WindowTitle = "Daily Report"
' CRViewer91.Action = 1 ' Run Report
Screen.MousePointer = vbDefault
Set rs = Nothing
End Sub
Private Sub Form_Resize()
CRViewer91.Top = 0
CRViewer91.Left = 0
CRViewer91.Height = ScaleHeight
CRViewer91.Width = ScaleWidth
End Sub