The TransLution database is shipped with sample vbp code to print Crystal Reports, the key requirement however is to install the TransLution Crystal Report Viewer.

 

Once this is installed, the VBP code needs to call this application. A sample line of code to do this is shown below:

 

Process.Start("C:\Program Files (x86)\TransLution\TransLution Report Viewer\TransLutionReportViewer.exe",";sql2008;TL_StandardFunctions;" & strPathAndFile & ";PRINT;1;" & MstockCode & ";;"& LabelsPrinted &";")
 

The parameters (; delimited) that need to be passed to the report viewer are described below.

(1) Server Name
(2) Database Name
(3) Report Name (incl. Path)
(4) Decision. Either: VIEW, PRINT, or PDF
(5) Pass Parameters? Either: 0 or 1. If 1, (6) will contain the parameter/s passed to the report
(6) Parameters passed to the report. Can be left blank
(7) Printer name. Default printer will be used if left blank
(8) Number of copies. 1 will be used if left blank
(9) PDF File Name. Path and File Name of the PDF to save

Please ensure you have enough semi-colons to allow for all 9 parameters, even if some are blank.

For example:

(1) ;SERVER;TL_DEMO;C:\Report.rpt;PRINT;1;Hello;Printer01;2;
(2) ;SERVER;TL_DEMO;C:\Report.rpt;PDF;0;;;;C:\MyNewPDF.pdf;
(3) ;SERVER;TL_DEMO;C:\Report.rpt;VIEW;1;Hello;;;