I have a problem when trying to print Crystal Report 9.0 (file.rpt) from VB 6.0.
With the following VB code Crystal Report is loaded at “CRViewer91” control but when I click at the print button of “CRViewer91” then nothing to print.
Anyone may kindly help to resolve the print problemCode:'1. Variable Declaration Dim Cn As ADODB.Connection Dim rs2 As ADODB.Recordset Dim Conn As String Dim crystlApp As New CRAXDRT.Application Dim crystlRpt As CRAXDDRT.Report '2. “CRViewer91” control inserted on VB form. '3. Write VB code for connection to Oracle 8 in Form Load Private Sub Form_Load() Conn = "UID=abcde; PWD=youme; DRIVER={Microsoft ODBC for Oracle}; SERVER=;" Set Cn = New ADODB.Connection With Cn .ConnectionString = Conn .CursorLocation = adUseClient .Open End With End Sub '4. “Command1” control inserted on VB form '5. Wrote VB code to access Crystal Report 9.0(file.rpt) under Click event of command1 Private Sub Command2_Click() Set rs2 = Cn.Execute("select * from product, pricelist") Set crystlRpt = crystlApp.OpenReport("file.rpt", 1) crystlRpt.Database.SetDataSource rs2 crystlRpt.DiscardSavedData CRViewer91.ReportSource = crystlRpt CRViewer91.ViewReport CRViewer91.Zoom 80 End Sub
Advance thanks for such act.


Reply With Quote



Bookmarks