Solved

Setting Dynamic Path to Crystal Reports - RDC - VB

Posted on 2004-04-29
2
1,572 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Suggested Solutions

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

737 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