There are so many questions asked about CR not working properly on clients computer having problems like Physical database not found, logonserver errors,file not found and so on.
I have been testing this for past 3 days and found an anwer which i want to share with every one.
i use vb6 and cr 8.5. I create reports using RDC File definitions(ttx files) using Active Data. i have been facing few problems which got solved as given below.
steps :- 1) create a form in vb and put the crystal report viewer control CRV on the form. In the print command button click write the following code. 'pl note adocn is the connection object oledb connection to the database)
set rs = new adodb.recordset sql = "Select * from itemmst"
rs.Open sql, adoCN, adOpenStatic, adLockReadOnly
'below opening the rpt file Set CrxReport = CrxApplication.OpenReport(App.Path & "\rptItemLST.rpt")
'below for setting the logon information. it works even if 'ur database (access or sql server) is password protected. 'if u r using access database then the server name can be "Sql server" or even blank it does not matter as if it is blank it will use the server which was used at design time.
'for access u can use ' CrxReport.Database.Tables(i).SetLogOnInfo "", "database", "usernm", "password"
For i = 1 To CrxReport.Database.Tables.Count CrxReport.Database.Tables(i).SetLogOnInfo "sql server", "database", "usernm", "password" Next
with CrxReport .DiscardSavedData .Database.SetDataSource rs end with
CRV.ReportSource = CrxReport CRV.ViewReport
While CRV.IsBusy DoEvents Wend
2) while making the report -> start crystal reports -> choose report expert -> standard -> OK -> Database -> more data sources -> Active data ->Active Data(Field Deifnitions only) click New and the input the fields u want the output from the table. after that click File -> SAVE -> give the name of the ttx file -> click OK -> ADD ->Close Now ur ttx file is ready and then u click next and like wise create the report. After that u can design the report using the ttx file fields and then save the report.
once the above two steps are ready the report works ok. I have tried to explain the steps in a simple way. i hope it helps somebody.
Please note:- While distributing ur project be sure to have these 3 files among other for using the crystal reports with active data (ttx) Craxdrt.dll, crviewer.dll, p2smon.dll
this p2smon.dll is the one used for active data(ttx) for odbc data sources u have to add p2sodbc.dll and also u need to install mdac_typ.exe on the client machine