Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
| Search | Today's Posts | Mark Forums Read
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 8th, 2006, 09:59 AM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to polravi
Default Problem in Connection Property of Crystal report 9

Hi All,

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:

Option Explicit

    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
    Next
    CrDatabase.Verify
End Sub

'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

    SetConnection CrxRpt

    CrxRpt.RecordSelectionFormula = CrxRpt.RecordSelectionFormula + " and " + Trim(rptfomula)
    CRViewer91.DisplayGroupTree = False
    CRViewer91.Height = ScaleHeight
    CRViewer91.Width = ScaleWidth
    CRViewer91.Refresh
    CRViewer91.Visible = True
    CRViewer91.ViewReport
End Sub



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

Program VB6.exe

This app has requested the runtime to terminate it in an unusual way.

Please help. Has anyone had this problem. Thanks for any help.

Ravi Pol






Similar Threads
Thread Thread Starter Forum Replies Last Post
CRYSTAL REPORT 9 Changing Connection Properties aquiintac VB Components 0 November 6th, 2007 05:17 AM
vb connection with crystal report freeska Pro VB 6 2 September 19th, 2007 10:30 PM
Crystal Report Connection using C# in ASP .net junaidameen Crystal Reports 1 September 25th, 2005 12:11 PM
crystal report 8.0 connection with oracle 8i perso shah_sameer82 Crystal Reports 1 June 7th, 2004 12:13 AM
Crystal Report Database Connection winnie1778 Crystal Reports 2 October 15th, 2003 07:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.