Click to See Complete Forum and Search --> : Crystal Report Connection In Vb6


aquiintac
November 6th, 2007, 08:36 PM
I'm using crystal report and vb6. how can i change the connection properties of the crystal report in vb6?

I'm using a udl for my connection. I have two databases namely TK and TK_MCC. TK is for other company and TK_MCC is for the subsidiary company. I used TK database when I created the crystal report. How can I change the connection properties in Crystal Report using vb6 so when I change my udl to TK_MCC it will run properly? I tried using the code below but it doesn't change the connection properties of the crystal report.

Global crxReport As CRAXDRT.Report

With crxReport.Database.Tables

For intCount = 1 To .Count
.Item(intCount).ConnectionProperties.Item("Data Source") = sServer
.Item(intCount).ConnectionProperties.Item("Initial Catalog") = sDBName_
.Item(intCount).ConnectionProperties.Item("User Id") = sUserName
.Item(intCount).ConnectionProperties.Item("password") = sPassword
Next

End With

How can I do it without creating a new crystal report just for TK_MCC?

Thank you very much.

dglienna
November 6th, 2007, 08:52 PM
See if this helps.

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=3166&lngWId=10

aquiintac
November 6th, 2007, 11:18 PM
I can't find in the article what will be the approach...

dglienna
November 6th, 2007, 11:36 PM
He just has code samples with 6 ways to connect to the UDL.