Tuesday, February 14, 2012

Crystel Reports 8.0 Immadiate help!

Hi!! I have to change reporting path of reports with code but i couldn't do it. I found somethin here using craxdrt.dll but i couldn't. Anyone have codes about this problem? I have to deliver my project on monday but only this part is missing... I need immediate help!!!CR = CRYSTAL REPORTS

First of all your post is very short and not in detail. Pls specify full details when you post a question -> like COMPILER, REPORTING ENGINE WITH VERSION and if possible the code your having trouble with...

I cant help you with the code cause I dont use that technique. But I have juggled with it a few times... So heres the deal. If your using VB6 then CR comes with an activex designer.

If yur using the activex designer like me then you cannot change the database path of the report at runtime! Its only possible when you have created a separate .rpt file and youre loading that report from the disk to the viewer. If you want to use the activex designer then you must supply a datasource i.e. the number of tables that you have added in the report like :

rpt_Global.Database.SetDataSource rsM, , 1

this will give the report what it needs it will no longer look for the database.
The database and datasource that I use are Active Data -> ADO. You can find a small glimpse of what Active Data does in the useless CR documentation. If youre using external reports then u can set the path of the database at runtime like this :

dim rpt_App as new CRAXDRT.Application

Dim rpt_Global As New CRAXDRT.Report

Set rpt_Global = rpt_App.OpenReport(App.Path & "\reports\report1.rpt" )

' :::: discard any data stored in the report its imp.
rpt_global.DiscardSavedData

Dim DataFiles As CRAXDRT.DatabaseTables

Set DataFiles = rpt_Global.Database.Tables

DataFiles(1).SetLogOnInfo "", yourmdbPath , ,"yourpassword"

hope this code would resolve your problem. One more thing, What you can do on your own that cannot be done by any guru on this forum... so keep trying and experimenting...

No comments:

Post a Comment