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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How To Change Database of Crystal Report

Status
Not open for further replies.

slinko

Programmer
Jan 21, 2001
14
0
0
US
Hi All,
I am opening a crystal report(v8.5) in VB which uses bound fields to an Access database table. However when I move the database file or change the directory, I get an error when it tries to view the report. I checked other posts and found a lot of references to

Report.Database.Tables(n).SetLogInInfo

however I can't get it to work. The database file is on the local drive, not a server. I also read a post in the VB general discussions area that said that changing an Access database at run time is not supported. Any info would be greatly appreciated.
 
Hi Slinko,

Within Crystal you would do it via
Database...
Convert Database Driver...
re-link to access ODBC Driver...
re-select the required file from your PC Directory.

No idea how you would do it via VB !!

Hope this helps,
Geoff
 
I have a DLL I created using these functions automatically, so I don't have to write this in every program. Here is the syntax I use:

Private CrystalDatabase As CRPEAuto.Database
Private CrystalTables As CRPEAuto.DatabaseTables
Private CrystalTable As CRPEAuto.DatabaseTable

Set CrystalDatabase = CrystalReport.Database
Set CrystalTables = CrystalDatabase.Tables
For TableCount = 1 To CrystalTables.Count
Set CrystalTable = CrystalTables.Item(TableCount)
CrystalTable.Location = DataFileLocation
Next TableCount


Hope this helps
 
casman2, Thanks for pointing me in the right direction, my problem has been solved. I was trying to access the tables, not the items of the tables collection. Thank you very much!!!!!!B-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top