crystal report path on the target machine

hi i have a project where i am using crystalreports.I have a problem when i deployee my application into the target the code i have written

cr1.reportsource="c:\ems\Reports\test.rpt".It works fine on my machine but in the target machine i have an errors"Loadreport failed".

how can i view the reports in the target know there is a app.path in vb6  where you can find the file .
how do i use in
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Use System.Windows.Forms.Application.StartupPath. Don't forget to append a backslash "\" to the end of the path. For example:

  cr1.reportsource=System.Windows.Forms.Application.StartupPath + "\test.rpt"


  Nayer Naguib
hariprasadereAuthor Commented:
again i have same problem here is my code
cr1.ReportSource = System.Windows.Forms.Application.StartupPath + "\shiphari.rpt"
After Salutation

Did you create your report by the Wizard?
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

hariprasadereAuthor Commented:
yes i did
If so,

Sure,the proplem not where are the report , BUT

where are the database where can i get the table(query/view) which the report depend on it.

if so i can help you with the code instead to solve the problem.
please try to do this ,and give me the feedback

Imports CrystalDecisions.CrystalReports.Engine

        Dim report As New test   'where test is your report name which was created previously .rpt
        Dim tab1 As Table
        tab1 = report.Database.Tables("mytest") 'where mytest the view name in the database
        tab1.Location = Application.StartupPath & "\databasename.mdb""
make sure that you saving the report .rpt beside the program .exe

Good Luck

Eng. Medhat Zakaria

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Thanks ,

i'm glad you accppted my answer, so you had solved your problem

thanks for the points.........
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.