Link to home
Start Free TrialLog in
Avatar of MrBlubke
MrBlubke

asked on

printing crystal report records

how can I print a record from a crystal report.
Avatar of MrBlubke
MrBlubke

ASKER

please rather urgent....
Avatar of Éric Moreau
This is a procedure that will help you print CR report from VB.

You can specify a criteria. This will reduce the amount of data printed.

Public Sub PrintCRReport(ByVal pstrReportFile As String, _
                          Optional ByVal pstrCriteria As Variant, _
                          Optional ByVal pbytDestination As Byte = 0)
Dim intResult As Integer

    With fMainForm.CrystalReport1
        If Not IsMissing(pstrCriteria) Then
            .SelectionFormula = pstrCriteria
        End If

        .WindowState = crptMaximized
         
        .ReportFileName = App.path & "\" & pstrReportFile
        .Destination = pbytDestination
        .WindowTitle = App.Title & " - " & pstrReportFile
         
        intResult = .PrintReport
        If intResult <> 0 Then
            MsgBox "Error occured." & _
                   vbCrLf & .LastErrorNumber & ": " & .LastErrorString, _
                   vbCritical + vbOKOnly, _
                   "Print error"
        End If
    End With
End Sub
ASKER CERTIFIED SOLUTION
Avatar of ChaseZero
ChaseZero

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial