I have a major problem with Crystal Reports I'm hoping someone can help.
I'm using VB6, ADO 2.0 and CR9.0.
I have a simple report that everytime on the second run of the report I get the following error message:
Error Number: 2147417848
An error has occurred: [-2147417848]
Method 'Value' of object 'IConnectionProperty' failed
Here is the code it happens on:
Dim CrxApp As New CRAXDRT.Application
Dim CrxRpt As New CRAXDRT.Report
Private Sub SetConnection(CR As CRAXDRT.Report)
Dim CrDatabase As CRAXDRT.Database
Dim i As Integer
Set CrDatabase = CR.Database
For i = 1 To CrDatabase.Tables.count
CrDatabase.Tables.Item(i).ConnectionProperties("Da tabase") = SysDBName 'SysDBName is my database name
CrDatabase.Tables.Item(i).ConnectionProperties("Us eDSNproperties") = True
'This is the procedure used to initialize crystal report
Public Sub InitForm(rptfilename As String, rptfomula As String)
Set CrxRpt = CrxApp.OpenReport(GetTemplatePath("Maintenance Summary.rpt")) 'GetTemplatePath gives the report path
CRViewer91.ReportSource = CrxRpt
CrxRpt.RecordSelectionFormula = CrxRpt.RecordSelectionFormula + " and " + Trim(rptfomula)
CRViewer91.DisplayGroupTree = False
CRViewer91.Height = ScaleHeight
CRViewer91.Width = ScaleWidth
CRViewer91.Visible = True
It seems to happen the second time through as I said before, and it seems that the line "CrDatabase.Tables.Item(i).ConnectionProperties("D atabase") = SysDBName" is causing the error.
If I break at that point and hold my mouse over the code VB
crashes with the following error:
Microsoft Visual C++ Runtime Library
This app has requested the runtime to terminate it in an unusual way.
Please help. Has anyone had this problem. Thanks for any help.