I can't get the Crystal 10 viewer to switch databases. SQL 2000, Crystal, VB 6.0, CRAXDRT

I can't get the Crystal 10 viewer to switch databases.  I have some code below that worked with the CRAXDRT.dll library in Crystal 8.5.  I commonly have to fire a crystal reports that are pointed at SQL servers and usually use either OLEDB or ODBC as it's connection.  I am always having to test a crystal report agains a test database, and then copy this crystal report into a production environtment.   Since the software we support moved to crystal 10 (yeah I know that was a while ago...) I haven't been able to get the craxdrt library to actually switch databases.  It just continues to point at the database that was used to develope the crystal report.

Below is the boiled down VB 6.0 code I use:

Public pbReport As CRAXDRT.report
Public Sub RunReport(ByVal PnFileNameIN As String)
Dim report  As New CRAXDRT.report
Dim crxApplication As New CRAXDRT.Application
Dim crxDatabase As CRAXDRT.Database
Dim crxDatabaseTable As CRAXDRT.DatabaseTable

Set report = crxApplication.OpenReport(PnFileNameIN, 1)

For Each crxDatabaseTable In report.Database.Tables
crxDatabaseTable.SetLogOnInfo "ODBC datasource name", Database, "<<Use Integrated Security>>"
crxDatabaseTable.SetLogOnInfo server, Database, user, pwd
Next crxDatabaseTable
Set pbReport = report
' frmprint uses PBreport as it's reportsource

End Sub

Who is Participating?
rskuyaConnect With a Mentor Author Commented:
No worries everyone.  Sorry to say, but I must give credit to Tek-tips.com and the 2005 addendum found at the bottom of this posting:

Problem solved
MIKESoftware Solutions ConsultantCommented:
And just to verify...these databases are on DIFFERENT servers....correct?

Is data saved with the report?

Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

rskuyaAuthor Commented:
To answer both of your questions, the Data is not saved with the report,
and the Server remains the same, only the Database changes.  

In addition, the user has dbo access to both databases.  
rskuyaAuthor Commented:
Anyone have any ideas, or similar experience? I bumped up the points hoping someone would take a renewed interest.
rskuyaAuthor Commented:
I looked for the TableLogOnInfo method in the CRAXDRT library, as it seems to be the focal point of the two examples you provided, but I could not find it.  Is there another library I should be referencing, or did you have any luck finding a VB 6 example?  I'm somewhat trapped in VB 6 era technologies for a while, so .net solutions don't usually help.

Thanks for any help!
rskuyaAuthor Commented:
Bump the points up.  Any one have any other ideas...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.