|
-
Aug 8th, 2006, 01:07 AM
#1
Thread Starter
Addicted Member
[RESOLVED] Crystal Reports 9 Database Problem
Hello I created a Crystal Report from Access Database. And my application wored good. Now when im trying to run the report from another PC, it says that the path to Database is not valid, and is display the original datbase path.
how do i give the path of Access Database to Crystal Report in my code.
Women ...r like tea bags, you neva know how strong they really r untill u put them in hot water
Huzefa Yousuf
Software Engineer
Verticity Inc.
+92-345-2235303
[email protected]
-
Aug 8th, 2006, 01:32 AM
#2
Fanatic Member
Re: Crystal Reports 9 Database Problem
How Do You Connect Crystal Report To Database..through Dsn Or Any Other Method ?
-
Aug 8th, 2006, 02:41 AM
#3
Thread Starter
Addicted Member
Re: Crystal Reports 9 Database Problem
This is the Code i use to connect to report.
VB Code:
Dim objCrystal As New CRAXDRT.Application
Dim objReport As CRAXDRT.Report
Set objReport = objCrystal.OpenReport(App.Path & "\Reports\rptPupil.rpt")
objReport.DiscardSavedData
crViewer.ReportSource = objReport
crViewer.ViewReport
Do While crViewer.IsBusy
DoEvents
Loop
crViewer.Zoom (94)
objRS.Close
Form_Resize
Thats It. The Report is depending on a View from the Access Database. At the moment the Report is trying to statically locate the database from its orignial location, i want to give it the path of the Database from where it should load that Recordset.
Women ...r like tea bags, you neva know how strong they really r untill u put them in hot water
Huzefa Yousuf
Software Engineer
Verticity Inc.
+92-345-2235303
[email protected]
-
Aug 8th, 2006, 03:39 AM
#4
Addicted Member
Re: Crystal Reports 9 Database Problem
why don't you distribute the report with your app?
That way it would be loaded in the app.path above on installation of your app.
-
Aug 8th, 2006, 10:48 AM
#5
Thread Starter
Addicted Member
Re: Crystal Reports 9 Database Problem
thats exactly what i want actually. and im distributing my reports with my app. i have told you guys the code, give me an example of how to achieve it.
Women ...r like tea bags, you neva know how strong they really r untill u put them in hot water
Huzefa Yousuf
Software Engineer
Verticity Inc.
+92-345-2235303
[email protected]
-
Aug 8th, 2006, 02:11 PM
#6
PowerPoster
Re: Crystal Reports 9 Database Problem
Your code shows where the report is, not the db. Does your report use a mapped drive?
-
Aug 9th, 2006, 12:16 AM
#7
Thread Starter
Addicted Member
Re: Crystal Reports 9 Database Problem
this is what im trying to ask you guys, see let me tell you hierarchy of the application. there is an application folder. in that folder i have two subfolders, one for Database and one for Reports. and i do not use Map Drive
again i ask the same question, how do i tell my report that get the data from this folder and this database. How ?
Women ...r like tea bags, you neva know how strong they really r untill u put them in hot water
Huzefa Yousuf
Software Engineer
Verticity Inc.
+92-345-2235303
[email protected]
-
Aug 9th, 2006, 12:17 AM
#8
Addicted Member
Re: Crystal Reports 9 Database Problem
You can create a dsn on the fly pointing to the database.
-
Aug 9th, 2006, 12:18 AM
#9
Addicted Member
Re: Crystal Reports 9 Database Problem
oops crosed threads there m8
-
Aug 9th, 2006, 12:43 AM
#10
Re: Crystal Reports 9 Database Problem
You can set the database location like this
VB Code:
objReport.Database.Tables(1).Location = "path & name of your database"
If this report references more than 1 table, you need to put that line of code for each one. For example if your report referenced a table called 'Cust Names' in the database 'C:\Customers.mdb' and another table called 'Invoices' in the database 'C:\Sales.mdb' your code would look like this
VB Code:
objReport.Database.Tables([color=red]1[/color]).Location = "C:\Customers.mdb"
objReport.Database.Tables([color=red]2[/color]).Location = "C:\Sales.mdb"
The numbers in red are the table ordinals, ie they represent in which order the tables appear in your report file. You can determine this by selecting Database Expert from the Database menu in Crystal. On the right hand side all the tables used in the report will be listed, the first table is '1', the second is '2' and so on.
Pete
No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.
-
Aug 10th, 2006, 01:54 AM
#11
Thread Starter
Addicted Member
Re: Crystal Reports 9 Database Problem
yes gr8 ! that did ! thankx alot.
Women ...r like tea bags, you neva know how strong they really r untill u put them in hot water
Huzefa Yousuf
Software Engineer
Verticity Inc.
+92-345-2235303
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|