Advertisement
4_2005-2006 Databases/ Data Access/ DAO/ ADO #169581

Crystal Report 8.5 and 10

crystal report 8.5 and 10.. dynamic server using setLogoninfo in sqlserver

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
'-------
'for crystal report 8.5
'Add this code to a form named form1 with a CrystalReports Viewer and reference
'the Crystal Reports 8.5 ActiveX Designer Run Time Library
'-------
'-------
'for crystal 10.0 
'Add this code to a form named form1 and module with a CrystalReports Viewer and reference
'the Crystal Reports ActiveX Designer Run Time Library 10.0
'-----------

'form
Option Explicit
'Add this code to a form named form1 and module with a CrystalReports Viewer and reference
'the Crystal Reports ActiveX Designer Run Time Library 10.0

Private Sub Form_Load()
  strSelect = " your sqlquery"
  viewReport strSelect, App.Path & "\your report file"
End Sub

Private Sub Form_Resize()
CRViewer1.Width = ScaleWidth
CRViewer1.Height = ScaleHeight
End Sub
'--------------
'module
Option Explicit
Public crApp As New CRAXDRT.Application
Public crRep As CRAXDRT.Report
Public dbTable As CRAXDRT.DatabaseTable
Public strSelect As String
Function viewReport(ByVal strSql As String, ByVal strReportFile As String)
Set crRep = New CRAXDRT.Report
Set crApp = CreateObject("crystalruntime.application")
Set crRep = crApp.OpenReport(strReportFile)
For Each dbTable In crRep.Database.Tables
 dbTable.SetLogOnInfo "servername", "databasename", "", ""
Next dbTable
crRep.SQLQueryString = strSql
Form1.CRViewer1.ReportSource = crRep
Form1.CRViewer1.viewReport
Set crRep = Nothing
Set crApp = Nothing
End Function
Original Comments (3)
Recovered from Wayback Machine