Crystal Reports Snip->(Change SQL on Compiled Report) This snip changes the SQL and DB location in
Crystal Reports Snip->(Change SQL on Compiled Report) This snip changes the SQL and DB location in a COMPILED report. (a report that was
Rate Crystal Reports Snip->(Change SQL on Compiled Report) This snip changes the SQL and DB location in
(1(1 Vote))
'the Crystal Reports 8.5 ActiveX Designer Run Time Library
Public Function ViewReport(ByVal strSQL As String, ByVal strReportFile As String)
Dim CRReport As CRAXDRT.Report
Dim CrxApp As New CRAXDRT.Application
Dim dbTable As CRAXDRT.DatabaseTable
'Required: Use the OpenReport method of the Application object to open the report.
Set CRReport = New CRAXDRT.Report
Set CrxApp = CreateObject("crystalruntime.application")
Set CRReport = CrxApp.OpenReport(strReportFile)
'Required: Prepare the tables to look at the correct database for a dynamic query
For Each dbTable In CRReport.Database.Tables
dbTable.SetLogOnInfo "Servername", "databasename", "username", "password"
Next dbTable
'Required: Add dynamic Query to Compiled report
CRReport.SQLQueryString = strSQL
CRViewer1.ReportSource = CRReport
'CRReport.PrintOut False, 1, True
CRViewer1.ViewReport
Form1.Visible = True
Set CRReport = Nothing
Set CrxApp = Nothing
Set CRReport = Nothing
End Function
Crystal Reports Snip->(Change SQL on Compiled Report) This snip changes the SQL and DB location in Comments
No comments yet — be the first to post one!
Post a Comment