This is a working example of printing a saved Crystal Report. You need to add the Crystal Report references to your project:

VB Code:
  1. Private Sub Command1_Click()
  2.    
  3.    'Print a saved Crytal Report
  4.    
  5.    'Visual Basic 6.0
  6.    'Crystal reports 8.0
  7.  
  8.    Dim rsTempRecordset As New ADODB.Recordset
  9.    Dim CR_CustomApp As New CRAXDRT.Application
  10.    Dim CR_CustomReport As CRAXDRT.Report
  11.    Dim prn As Printer
  12.    
  13.    'Using SQL 2000
  14.    
  15.    With cnCMS
  16.        .CursorLocation = adUseClient
  17.        .ConnectionString = "MSDASQL.1;" & _
  18.           "Persist Security Info=True;" & _
  19.           "User ID=sa;" & _
  20.           "Password='';" & _
  21.           "Data Source=CMS"
  22.        .Open
  23.    End With
  24.    
  25.    'You can use the data saved with the report.  I want it fresh everytime.
  26.    
  27.    With rsTempRecordset
  28.       If .State = adStateOpen Then
  29.           .Close
  30.       End If
  31.       .ActiveConnection = cnCMS
  32.       .LockType = adLockOptimistic
  33.       .Source = "Select * from ScanDocumentsErrors "
  34.       .Open
  35.    End With
  36.    
  37.    Set CR_CustomReport = CR_CustomApp.OpenReport("c:\@@crystal\TwainReport.rpt", 1)
  38.    
  39.    'Use can use the printer saved with the report and skip this part.  Or
  40.    'use the loop to display the printer avaiable to you.  Mine were:
  41.    
  42.    ' Availble Printer names:
  43.         ' TPA
  44.         ' Federal
  45.         ' hp LaserJet
  46.         ' State
  47.    
  48.    For Each prn In Printers
  49.       If prn.DeviceName Like "*LaserJet*" Then
  50.          Set Printer = prn
  51.          Exit For
  52.       End If
  53.     Next
  54.  
  55.    CR_CustomReport.SelectPrinter prn.DriverName, prn.DeviceName, prn.Port
  56.    
  57.    'Get rid of saved date
  58.    
  59.    CR_CustomReport.DiscardSavedData
  60.                    
  61.    'Use can use the orientation saved with the report or override it.
  62.    'DefaultPaperOrientation = 0
  63.    'Portrait = 1
  64.    'Landscape = 2
  65.    
  66.    CR_CustomReport.PaperOrientation = 2
  67.                    
  68.    CR_CustomReport.Database.SetDataSource rsTempRecordset
  69.    
  70.    CR_CustomReport.PrintOut False
  71.    
  72.    Set CR_CustomReport = Nothing
  73.    Set rsTempRecordset = Nothing
  74.    cnCMS.Close
  75.    
  76. End Sub