Hi everybody
I need your help for calling crystal report 8.5 into VB6. Below mention VB code i use for display the report but if 'CRReport.DiscardSavedData' is activate then it show error message "Server has not yet been opened"
else display the report but not refresh the data.
(I am useing SQL Server 2000 connection through DSN
ConnectAcct.Open "DSN=Asmacct; User Id=sa; password=;")
Pls help me how to call report with refreshing data everytime..Waiting for help...VB Code:
Private Sub CrAppView() Dim CRApp As CRAXDRT.Application Dim CRReport As CRAXDRT.Report Dim CRRepRs As ADODB.Recordset Dim CRSql As String Set CRApp = New CRAXDRT.Application Set CRRepRs = New ADODB.Recordset CRViewer.DisplayBorder = False CRViewer.EnableGroupTree = False CRViewer.DisplayTabs = False CRViewer.EnableDrillDown = False CRViewer.EnableRefreshButton = False CRViewer.EnableExportButton = True CRSql = "select * from PluckDetail where monyear = '" & TxtMonyear.Text & "' order by dvcode, empcode" CRRepRs.Open CRSql, ConnectAcct, adOpenStatic, adLockReadOnly Set CRReport = CRApp.OpenReport(App.Path & "\pluck31.rpt") CRReport.FormulaFields.GetItemByName("compname").Text = "'" & CompanyName & "'" CRReport.FormulaFields.GetItemByName("monthname").Text = "'" & TxtMonyear.Text & "'" CRReport.DiscardSavedData CRReport.Database.SetDataSource CRRepRs CRViewer.ReportSource = CRReport CRViewer.ViewReport Call PreviewZoom 'Zoom the Report View CRRepRs.Close Set CRApp = Nothing Set CRReport = Nothing Set CRRepRs = Nothing End Sub
Thanks
ASM




Reply With Quote