Results 1 to 11 of 11

Thread: [RESOLVED] Crystal Reports 9 Database Problem

Hybrid View

  1. #1

    Thread Starter
    Addicted Member hyousuf2's Avatar
    Join Date
    Dec 2004
    Location
    Dublin
    Posts
    226

    Resolved [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]

  2. #2
    Fanatic Member
    Join Date
    Jul 2006
    Location
    nasik,india
    Posts
    909

    Re: Crystal Reports 9 Database Problem

    How Do You Connect Crystal Report To Database..through Dsn Or Any Other Method ?

  3. #3

    Thread Starter
    Addicted Member hyousuf2's Avatar
    Join Date
    Dec 2004
    Location
    Dublin
    Posts
    226

    Re: Crystal Reports 9 Database Problem

    This is the Code i use to connect to report.

    VB Code:
    1. Dim objCrystal As New CRAXDRT.Application
    2.    Dim objReport As CRAXDRT.Report
    3.     Set objReport = objCrystal.OpenReport(App.Path & "\Reports\rptPupil.rpt")
    4.     objReport.DiscardSavedData
    5.     crViewer.ReportSource = objReport
    6.     crViewer.ViewReport
    7.    
    8.     Do While crViewer.IsBusy
    9.         DoEvents
    10.     Loop
    11.    
    12.     crViewer.Zoom (94)
    13.     objRS.Close
    14.     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]

  4. #4
    Addicted Member
    Join Date
    Jul 2006
    Posts
    151

    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.

  5. #5

    Thread Starter
    Addicted Member hyousuf2's Avatar
    Join Date
    Dec 2004
    Location
    Dublin
    Posts
    226

    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]

  6. #6
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Re: Crystal Reports 9 Database Problem

    Your code shows where the report is, not the db. Does your report use a mapped drive?

  7. #7

    Thread Starter
    Addicted Member hyousuf2's Avatar
    Join Date
    Dec 2004
    Location
    Dublin
    Posts
    226

    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]

  8. #8
    Addicted Member
    Join Date
    Jul 2006
    Posts
    151

    Re: Crystal Reports 9 Database Problem

    You can create a dsn on the fly pointing to the database.

  9. #9
    Addicted Member
    Join Date
    Jul 2006
    Posts
    151

    Re: Crystal Reports 9 Database Problem

    oops crosed threads there m8

  10. #10
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918

    Re: Crystal Reports 9 Database Problem

    You can set the database location like this
    VB Code:
    1. 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:
    1. objReport.Database.Tables([color=red]1[/color]).Location = "C:\Customers.mdb"
    2. 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.

  11. #11

    Thread Starter
    Addicted Member hyousuf2's Avatar
    Join Date
    Dec 2004
    Location
    Dublin
    Posts
    226

    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
  •  



Click Here to Expand Forum to Full Width