[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 382
  • Last Modified:

Crystal Reports DB problem

Hi experts.

I have a report, designed with crystal Reports. This report has been designed using an ODBC connection, using some tables on an ORACLE server. However I have an MS Access (.mdb) database with the same tables.
I need to change the connection at runtime, so, depending on the user's selection, the report should read either the Oracle database or the MSAccess database.....

Is this possible?
0
trillo
Asked:
trillo
  • 2
1 Solution
 
Éric MoreauSenior .Net ConsultantCommented:
I think that it is easier to change your ODBC settings than your database location.

One easy way to change your ODBC settings is to use the RegisterDatabase method (found in DAO).
0
 
jfleminCommented:
Are you talking about changing the title from 'Oracle database'
to 'MSAccess database'?

Are you using the Report Design Component?

Are you asking for the VB code to change the location from Access to Oracle?

All of these are possible, but I'm not sure which one to answer.
0
 
trilloAuthor Commented:
I'm looking for the VB code to change the ODBC connection... i've been trying the whole day long without success.

I've been changing the Connect propery for the Crystal Reports control, but it just doesn't work
0
 
jfleminCommented:
Do you have two ODBC DSN set up? One for Oracle and one for Access. I'll assume that this is the case. I'll also have to assume that your are using the Seagate Report Design Component inside of VB.

Say that you have an ODBC entry for Oracle called MyOra and one for Access call MyAccess.The login for both is databases is MyLogin and the password for both databases is MyPassword.

To log in to Oracle
-----------------------------------------------------------------
Report.Database.Tables.Item(1).SetLogOnInfo MyOra, "", MyLogin, MyPassword

To log in to Access
-----------------------------------------------------------------
Report.Database.Tables.Item(1).SetLogOnInfo MyAccess, "", MyLogin, MyPassword
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now