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!

Setting Database Location in report file

Status
Not open for further replies.

33216CLC

Programmer
Aug 17, 2000
173
BS
Hi,

How can I define a report so that whether the database file is on C, D or an other drive, I will not get an error when attempting to run a report from my program. Previously, I was able to run reports whose database was in a different location than the location set in the initial design of a report, without out a hitch.

For example, if the location/path at design time was C:\Pan\test.mdb, but myself or another user ran the front-end program who's database is at a different path (eg. C:\Pan2\test.mdb), the report would still run. Recently, however, if the actual path is different from the initial path, an error results.

How can I correct this so that I get the results I got before? Persons using the front-end program will not be able to open these report files and reset the location of the database.

One more thing, I noticed this problem occurred mostly with a report containing a sub report.

Thanks
 
Is your application setting the location for both the report and the subreport? This is often overlooked because they have to BOTH be set separately by the app if they aren't in the original location. Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
Ken,

1. If you are referring to the path of the report files, I only set the path of the main report using the code below;

rptEE.ReportFileName = MyAppPath + "paynote.rpt"

In the the code for previewing the report, the code below is used:

rptEE.Destination = crptToWindow
rptEE.WindowState = crptMaximized
rptEE.Connect = g_sRptConnect
rptEE.SubreportToChange = "ded_paynot"
rptEE.Connect = g_sRptConnect

rptEE.Action = 1
rptEE.Reset

Is this what you meant?
 
Setup the data as in windows as User DSN in ODBC. This way the user can have is own path as long as the name of the USER DSN is the same.

Example if you setup a User DSN in the windows control panel called "Report Data", and set whatever directory you want. Then you go into CR and use an ODBC data connection to Report Data -> Yourdata.mdb, then anyone who uses the report, can setup a User DSn on their local PC and as long as it is called "Report Data" it can point anywhere.

I hope this helps.
 
I believe that you have to set the path for both the report and the subreport separately, if they aren't the same as the original report design. Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
Hi Ken,

What I am trying to understand is whether you are referring to the path of the database file, or the path of the report files.

Thanks
 
The database files, there is only one path to the report (which includes the subreport).

Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
Hi Ken,

Believe it or not, I'm still having this problem. I have downloaded the crysal update utility to help with this problem and it works. My concern is that having to use the update utility would be to cumbersome for my users. Is there a way I can programmtically set the location of the database for all my reports with out have to have the location verified each time the path or app's folder name changes?

Just this afternoon, I got a call from a co-worker who stated that he had installed our app on the client's pc and called the app folder test. After being satified that the system is ready to go live he renamed the folder. Now.......none of the reports are coming up.

I have not hard-coded any path in my vb program, instead variables were used (As you can see from my earlier threads). The reference to the path in the dsn was also updated. When he reverted to using the name "Test", the reports came up.

Any thoughts?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top