Results 1 to 2 of 2

Thread: Showing result in vb6 to crystal rpeort 10's text box

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2007
    Posts
    37

    Showing result in vb6 to crystal rpeort 10's text box

    i am developng system in vb6 and crystal report 10 my problem is that i have created recordset in vb6 form now i want to show result in report 10 what systax i use i want this
    text box created named text1 in cr10
    rs!table_name=cr10.text1.text
    rs!table_name=cr10.text,1.settext
    but its not working

  2. #2
    Frenzied Member
    Join Date
    May 2006
    Location
    some place in the cloud
    Posts
    1,886

    Re: Showing result in vb6 to crystal rpeort 10's text box

    The next is an example to show a Crystal Reports' report using VB6
    In this example, the report is designed using ADO OLE DB (MS Access) as data source, then you have to modify to your data source requirements;
    (in order to do so , enter to Crystal Reports, select: menu / Database / SetDatasourceLocation / Current Data Source / Properties to display the properties you have to provide thru vb code )

    Code:
    'Declarations
    
    Public CRApplication    As New CRAXDRT.Application
    Public CRReport         As New CRAXDRT.Report
    Public CRConProp        As CRAXDRT.ConnectionProperty
    Public CRTabla          As CRAXDRT.DatabaseTable
    Public GRpt             As String  'Contains the report's name
    Public MyFolder		As String  'Contains the relative path to data and reports
    Public MInt2		As Integer 'Just a counter 
    Public GSelFor		As String  'Contains the RecordSelectionFormula
    Public GTitleA		As String  'Contains the Company's name
    Public GTitleB		As String  'Contains the Report's name
    Public GTitleC		As String  'Contains the dates's range
    '
    '
    '
    Sub PrintReport()
        'here define the report to show
        Set CRReport = CRAplicacion.OpenReport(MyFolder & "\" & GRpt, 1)
    
        'here change the relative data path to all the tables defined in the rpt
        'in this example all the tables are inside the same mdb file
        'here the datasource is thru ADO OLEDB (MS Access), 
        'if it is other datasource, as SQL, the ConecctionProperties will be different
        'Do not use if the relative data path doesn't change
        For MInt2 = 1 To CRReport.Database.Tables.Count
            Set CRTabla = CRReporte.Database.Tables(MInt2)
            Set CRConProp = CRTabla.ConnectionProperties("Database Type")
                CRConProp.Value = "OLE DB (ADO)"
            Set CRConProp = CRTabla.ConnectionProperties("Provider")
                CRConProp.Value = "Microsoft.Jet.OLEDB.4.0"
            Set CRConProp = CRTabla.ConnectionProperties("Data Source")
                CRConProp.Value = MyFolder & "\MyDataFile.mdb"
            Set CRConProp = CRTabla.ConnectionProperties("User Id")
                CRConProp.Value = "Admin"
            Set CRConProp = CRTabla.ConnectionProperties("Database Type")
                CRConProp.Value = "Access"
            Set CRConProp = CRTabla.ConnectionProperties("Locale Identifier")
                CRConProp.Value = "1033"
            Set CRConProp = CRTabla.ConnectionProperties("OLE DB Services")
                CRConProp.Value = "-6"
        Next MInt2
        
        'Modify existing rpt Formulas 
        'Do not use if there are no formulaes
        For MInt2 = 1 To CRReport.FormulaFields.Count
            Select Case CRReport.FormulaFields(MInt2).Name
                Case "{@a}"
                    CRReport.FormulaFields(MInt2).Text = "Trim(" & Chr(39) & GTitleA & Chr(39) & ")"
                Case "{@b}"
                    CRReport.FormulaFields(MInt2).Text = "Trim(" & Chr(39) & GTitleB & Chr(39) & ")"
                Case "{@c}"
                    CRReport.FormulaFields(MInt2).Text = "Trim(" & Chr(39) & GTitleC & Chr(39) & ")"
            End Select
        Next MInt2
        
        'Modify record selection criteria
        'Do not use if there is not record selection or this is not going to change
        If Trim(GSelFor) <> "" Then
            CRReport.RecordSelectionFormula = GSelFor
        End If
        
        'frmReport is the form that contains the CR10Viewer
        frmReport.Show vbModal   
        
        'Release resources
        Set CRTabla = Nothing
        Set CRConProp = Nothing
        Set CRReport = Nothing
        Set CRAplicacion = Nothing

Posting Permissions

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



Click Here to Expand Forum to Full Width