Link to home
Start Free TrialLog in
Avatar of adrianmak
adrianmak

asked on

database connection on crystal report

I have designed a report using crystal report.
In crystal report you should hardcode to point somewhere your database located e.g. c:\abc\abc.mdb
I use VB with Crystal Report activex control to call the crystal report xxx.rpt file. And this application is need to disbute to users. Then when user install my application and the database *.mdb located at different directory that
the *.rpt pointed to. As a result there may have error from crystal report that cannot found *.mdb or no data in the report.
Of course I can open the .rpt file to change the location of the dataabse the user will installed to. But it is not really feasible.

How do the report file know the database location ?
I think this must do with coding but i don't know

ASKER CERTIFIED SOLUTION
Avatar of alokanant
alokanant

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of adrianmak
adrianmak

ASKER

I have tried your proposed answer but failed.
When I click a command button that call the report, an runtime erro 20507 occur - invalid filename

I added
crystalreport1.datafiles(0)="d:\abc.mdb" in form-load event
do you have any ideas?
Have you set crystalreport1.reportfilename = [YourReport] before to tried to set the datafiles value??
hi
what version of Crystal reports are u using ?

Craig
rich, no becuase I have hardcode in the active control ?

rich, no becuase I have hardcode in the active control ?

Are you sure that the file "d:\abc.mdb" exists on the d:\ drive of your PC?
Are you sure the tables used in your report are same as those in "d:\abc.mdb"?
Try specifying the reportfile name using the method suggested by Rich at runtime.
I think you must be using CrystalReport1.Action = 1 to run the report from the form.
it work now.

hi well i have the same problem i want that my report shold pick up the database whereever installed

please help me its urgent

thanks
hi well i have the same problem i want that my report shold pick up the database whereever installed

please help me its urgent

thanks
hi well i have the same problem i want that my report shold pick up the database whereever installed

please help me its urgent

thanks