?
Solved

Change database name and location in Crystal Report

Posted on 1999-07-08
10
Medium Priority
?
475 Views
Last Modified: 2011-10-03
How can I change Database name and path in VB code for existing report.
I tried - Report1.DataFiles(0)=" C:\....."
Error-"Error detected by database DLL".
0
Comment
Question by:monax
[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
10 Comments
 
LVL 3

Expert Comment

by:jjmartin
ID: 1522868
What version of crystal reports are you using?
0
 

Author Comment

by:monax
ID: 1522869
Crystal Report Version 4.6.1 wich comes with VB5.0
0
 
LVL 1

Expert Comment

by:himachal
ID: 1522870
Hi,
Use the "Reportfilename" property of the crystal report to set thet.

Himachal
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:monax
ID: 1522871
Hi, Himachal.
Using ReportFileName property you can change path to your report, but I need to set new Database path and name. Because, I don't know where software will be installed and how the user will name the database. In code, I have a variable "strDBpath" wich I want to use.  

0
 
LVL 1

Expert Comment

by:apratima
ID: 1522872
Are you not using Print Engine API's which are necessary for this purpose?
I can give you the code. You can email me
0
 
LVL 3

Expert Comment

by:ivanc
ID: 1522873
I think the problem does not lie in the Crystal report but at the Database connection.  I wonder how are U connected to your Database, is it via RDO or ADO.  I would think that at run time U should prompt for the user to locate the database file and put the location in the connection string of the database

Hope this helps

Ivanc
0
 

Author Comment

by:monax
ID: 1522874
Thank you, but it's still not the answer, I'm looking for.
Database is Access and I have no problem to connect.
Everything works until I change database location.
0
 

Accepted Solution

by:
samirtapde earned 200 total points
ID: 1522875
You have to set the database file location for all the tables that you have included in the report. If you are using, say, three tables in your report, set the datafiles path for all the three tables

report1.datafiles(0)="C:\..."
report1.datafiles(1)="C:\..."
report1.datafiles(2)="C:\..."

Also the database at the new location and the one on which you have created the report should be identical, i.e, no database structure change should have been made. If such is the case, verify the report with the changed database.

0
 

Author Comment

by:monax
ID: 1522876
Ok, my database name is "Sales.mdb"
I'm using two tables  "Product" and "Client"
Code below does not work.
report1.datafiles(0)="C:\My Directory\Sales\Product"
report1.datafiles(1)="C:\My Directory\Sales\Client"
Please give the correct line.

0
 

Author Comment

by:monax
ID: 1522877
OK, I got it.
Thank you.
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

718 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