Windows Vista Forums

How to connect crystal report with vb 6.0

  1. #1


    Moses Guest

    How to connect crystal report with vb 6.0

    Hi, Can you please help me with the step by step of connecting crystal report
    with vb 6.0. I tried to include CrystalPrintControl on the project and add
    the following code but gives me errors:

    Option Explicit
    Private m_objRS As New ADODB.Recordset
    Private m_objReport As CRAXDRT.Report
    Private m_objApp As New CRAXDRT.Application

    Private Sub Command1_Click()
    Dim cn As New ADODB.Connection
    Dim strSQL As String

    cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\Program
    Files\VB98\NWIND.MDB"

    strSQL = "Select * From Customers"

    m_objRS.CursorLocation = adUseClient
    m_objRS.Open strSQL, cn, adOpenStatic

    Set m_objReport = m_objApp.OpenReport("F:\MyReport.rpt", 1)
    With m_objReport
    .Database.SetDataSource m_objRS, 3, 1
    .DiscardSavedData
    .ReadRecords
    End With

    With CRViewer1
    .ReportSource = m_objReport
    .ViewReport
    End With

    m_objRS.Close
    Set m_objRS = Nothing

    cn.Close
    Set cn = Nothing
    Set m_objReport = Nothing
    Set m_objApp = Nothing
    End SubIn this example I'm using

      My System SpecsSystem Spec

  2. #2


    Paul Randall Guest

    Re: How to connect crystal report with vb 6.0


    "Moses" <Moses@xxxxxx> wrote in message
    news:46488463-3727-467B-92E3-184A977A13BB@xxxxxx

    > Hi, Can you please help me with the step by step of connecting crystal
    > report
    > with vb 6.0. I tried to include CrystalPrintControl on the project and add
    > the following code but gives me errors:
    This newsgroup is named microsoft.public.scripting.vbscript.
    VB6 is NOT vbscript.
    Why not try a newsgroup with VB and CRYSTAL in it name, like
    microsoft.public.vb.crystal?
    Also, now that you know that there is a group with this name, you might
    try a groups.google.com search of that specific group.
    In the groups.google.com search box, type the following:
    crystal report vb6 group:microsoft.public.vb.crystal

    The first hit I get is How to use crystal report in VB6

    -Paul Randall



      My System SpecsSystem Spec


How to connect crystal report with vb 6.0
Similar Threads
Thread Forum
CRystal report Visual basic 2005 .NET General
Changing Crystal Report data source to a function .NET General
Crystal report crash with exotic font .NET General
V.Studio 2003 - unable to edit Crystal Report .NET General
Re: Passing Parameters to a Crystal Report with a Subreport .NET General