Link to home
Start Free TrialLog in
Avatar of jmantha709
jmantha709

asked on

Changing database doesn't work

I'm using CR10 and VB6.

I designed my report using a particular SQL database but at runtime, I wan't to change the database depending on the logon info from the user.

Here's the code I'm using :

Dim crxApplication As New CRAXDRT.Application, Report As CRAXDRT.Report, crxDatabaseTable As CRAXDRT.DatabaseTable

 Set Report = crxApplication.OpenReport(App.Path & "\Reports\MyReport.rpt", 1)
 For Each crxDatabaseTable In Report.Database.Tables
   crxDatabaseTable.ConnectionProperties("Data Source") = strDataSource
   crxDatabaseTable.ConnectionProperties("Initial Catalog") = strCatalog
   crxDatabaseTable.ConnectionProperties("Integrated Security") = True
Next crxDatabaseTable

Call frmReportViewer.LoadReportViewer(Report)


Everything runs without error but the report still comes out with the data from the old database.

What am I missing ??
ASKER CERTIFIED SOLUTION
Avatar of vidru
vidru

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jmantha709
jmantha709

ASKER

Excellent !

That was it, thanks !
Glad that did it.  I recently had the same problem.

-dave