Link to home
Start Free TrialLog in
Avatar of keithtbe
keithtbe

asked on

database

can anybody tell me the code of how to call a crystal report from visual basic?
pols help
urgent
Avatar of keithtbe
keithtbe

ASKER

Adjusted points to 50
Avatar of Éric Moreau
This is a procedure that will help you print CR report from VB:

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
sorry
what i want is to call the report that i generate in the crystal report and then view it in the visual basic
i hope that u can help me tp write the code to call the report from crystal report inside the visual basic
i hope that u know what i mean and help me
thanks alot
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
>what i want is to call the report that i generate in the crystal report and then view it in the visual basic

Depending on the version you are using, maybe you won't be able to see it IN vb. You need the version 6 or higher with the CR viewer in order to make your report sited on your form. See http://www.seagatesoftware.com/products/crystalreports/default.asp
thanks alot
i wil try and see
No probs.

:)

ChaseZero
another question
how can i ah set decimal point?
i mean when there is a text box that let people key in data
and how can i fixed the decimal point ?
another one
can u pls tell me ahhhhhhhhhhh
i want to fix that only number to key inside the text box and not text
so how to write the code?
and vice versa
thanks alot