Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select Database on the fly?

Status
Not open for further replies.

mrtroy

Technical User
Jan 28, 2003
23
US
Is is possible to create a crystal report where the user can select the database on the fly? I have 10 databases with identical tables names and structures. Each database represents data from a different company.
 
Yes.

Please post your environment:

Crystal version
Database/connectivity used
Are you using a front end, such as VB or Crystal Enterprise, or?

-k
 
Crystal 11
Developer version
connecting to sql databases
generating reports from crystal
 
CR XI, lucky guy.

One method is to use the Add Command feature in versions CR 9 and above, and use a parameter as the database name, then insert the parameter into the SQL in lieu of the database name.

-k

 
If the tables are in the same database, then you could use the SQL command as suggested above, but you can't change the DB connection this way as the SQL is specific to a ODBC connection.

One solution is to use a COM driver to select the repords and return the data in an ADO recordset. it's easy to write that with VB. Other ADO record sources could be attached using a front end program.




Editor and Publisher of Crystal Clear
 
Thanks for all the info. Would this work? Could I create a view that retrieves the records from multiple databases and then base the report on the view?

Troy
 
Hi,
If you can create a view in one datasource that contains all the data you will need from the other sources, you can add a field to each record that specifies the source of that data..Pass that value as a parameter in the report and you can then choose which datasource is being used.



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top