Solved

Setting Dynamic Path to Crystal Reports - RDC - VB

Posted on 2004-04-29
2
1,568 Views
Last Modified: 2012-06-27
OBJECTIVE:
I want to set the database path of crystal reports dynamically at run time and refresh the data based on the dsn connection.

DETAILS:
I have to use multiple databases in a project. Back end is MSAccess and Front End VB. The connection to the database is done using ODBC automatic dsn code. The reports are desinged

using CRViewer(RDC). The structure of all the databases are identical and only the stored data is different (For example sale details of current year in a database and the previous financial year in another database and so on.)

In the application, the connection to the particular database is done by selecting the available database and then making a dsn connectoin to the selected database at run time (using automatic dsn code).

Thus When the database path is changed dynamically, the new set of data from the latest database connection is to be refreshed in the crystal report. How can this be achieved?

0
Comment
Question by:r_venkatadhri
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 32

Accepted Solution

by:
bhess1 earned 500 total points
ID: 10951217
In CR, an ODBC connection is more difficult to change than many.  The method that I know of is:

Get the report tables
    Set CRXTables = CRXReport.Database.Tables  

Get the individual tables
    Set CRXTable = CRXTables.Item(1)

Finally, set the location of the .mdb file.
    CRXTable.SetLogOnInfo <ODBC_DSN>, <databasename>, <userid>, <password>

You may need to do this for all subreports as well separately (I don't use DSNs on a regular basis, so I don't know for sure)

If you are trying to make a DSNless connection, I would use ADO instead.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 10951281
Agree with bhess1.

Another thing is make certain the reports are saved with data.

Open a report
Click FILE
Ensure SAVE DATA WITH REPORT is not checked.

You can also add a line like

crRpt.DiscardSavedData to your application.

mlmcc
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question