RE: Unable to Set DataSouce Connection Information on Report with Sub Reports After updating to 13.0.17

      We are currently using  13.0.4, in the process of updating to 13.0.17 we noticed that any time that we run a report with subreports, Crystal would prompt for the database password.  After further investigation, I noticed that if the report has any subreports the SetConnection Overload that takes in the user name and password would not actually update the connection object.  Below i have posted the code that is being used.

      Dim CR As new CrystalDecisions.CrystalReports.Engine.ReportDocument

      CR.DataSourceConnections(0).SetConnection(dataPath & “test.mdb”, dataPath & “test.mdb”, “Admin”, “<password>”)

      For i As Integer = 0 To CR.Subreports.Count – 1

          CR.Subreports(i).DataSourceConnections(0).SetConnection(dataPath & “test.mdb”, dataPath & “test.mdb”, “Admin”, “<password>”)

      Next

      Hi Bryan,   Check your path: CR.DataSourceConnections(0).SetConnection, could be you need to add a "\".   CR.DataSourceConnections(0).SetConnection(dataPath & "\test.mdb", dataPath & "\test.mdb", "Admin", "<password>")   And check the subreport, the SDK is not as forgiving as the Designer, if any fields or formulae are using unknown fields then delete them.   The other issue is it could be you are using the JET engine. ODBC is recommended to MDB's now.   FYI - MS is getting away from MDAC and it's only 32 bit, you need 64 bit Office Access to be able to connect to accdb file.   Don

      User Rating: Be the first one !
      Add Comment
      1 Answers

        Hi Bryan,

         

        Check your path: CR.DataSourceConnections(0).SetConnection, could be you need to add a “\”.

         

        CR.DataSourceConnections(0).SetConnection(dataPath & “\test.mdb”, dataPath & “\test.mdb”, “Admin”, “<password>”)

         

        And check the subreport, the SDK is not as forgiving as the Designer, if any fields or formulae are using unknown fields then delete them.

         

        The other issue is it could be you are using the JET engine. ODBC is recommended to MDB’s now.

         

        FYI – MS is getting away from MDAC and it’s only 32 bit, you need 64 bit Office Access to be able to connect to accdb file.

         

        Don

        Add Comment

        Your Answer

        By posting your answer, you agree to the privacy policy and terms of service.