• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 478
  • Last Modified:

Change database name and location in Crystal Report

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
monax
Asked:
monax
1 Solution
 
jjmartinCommented:
What version of crystal reports are you using?
0
 
monaxAuthor Commented:
Crystal Report Version 4.6.1 wich comes with VB5.0
0
 
himachalCommented:
Hi,
Use the "Reportfilename" property of the crystal report to set thet.

Himachal
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
monaxAuthor Commented:
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
 
apratimaCommented:
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
 
ivancCommented:
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
 
monaxAuthor Commented:
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
 
samirtapdeCommented:
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
 
monaxAuthor Commented:
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
 
monaxAuthor Commented:
OK, I got it.
Thank you.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

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