Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2006
    Posts
    8

    Question Unanswered: Filter data for Crystal Report 8.5 using a SQL query with a parameter

    Hi, happy new year everyone.

    And here is may problem. I Need Filter data for Crystal Report 8.5 using a SQL query with a parameter. Using the IDE VB6 designers a can filter the data but I want to get it opennig the report.
    Down is a sample of my code.

    Modulo1

    Option Explicit
    Global cnn As ADODB.Connection

    Sub main()

    Dim f As New FrmParametros
    Set cnn = New ADODB.Connection
    cnn.Open "Provider=Microsoft.Jet.OLEDB.3.51;" & _
    "Persist Security Info=False;" & _

    "Data Source=" & App.Path & "\xtreme.mdb"
    FrmParametros.Show
    End Sub

    FrmParametros

    Option Explicit
    Public m_App As New CRAXDRT.Application
    Public m_Report As CRAXDRT.Report

    Private Sub Form_Load()
    On Error GoTo ERRORCARGAR
    Set m_Report = m_App.OpenReport(App.Path & "\ListadoDeClientes.rpt", 0)
    Exit Sub
    ERRORCARGAR:
    MsgBox Err.Number & " " & Err.Description & " " & Err.Source
    End Sub

    Private Sub Command1_Click()
    Dim rs As New ADODB.Recordset

    'CRITERIA: With this command I'm trying to filter the costumers whose country=USA
    rs.Open "SELECT * FROM Customer WHERE Country = 'USA'", cnn, 3, 1
    m_Report.Database.SetDataSource rs, 3, 1
    End Sub

    FrmReporte

    Private Sub Form_Load()
    CRViewer1.ReportSource = FrmParametros.m_Report
    CRViewer1.ViewReport
    End Sub


    Thank.
    Last edited by VBeginner; 01-05-07 at 22:25.

  2. #2
    Join Date
    Apr 2006
    Posts
    8

    Please someone help me

    I want to do a parameter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •